Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
next.jsを使ったuniversal React 入門
Search
Hori Godai
December 14, 2018
Programming
1
320
next.jsを使ったuniversal React 入門
Hori Godai
December 14, 2018
Tweet
Share
More Decks by Hori Godai
See All by Hori Godai
TypeScript Compiler APIを使って 型のユニットテストをブラウザーで動かす
steelydylan
3
250
エディター付きのReact開発環境を ブラウザーだけで実装した話
steelydylan
9
2k
HonoでReact・TypeScriptの実行環境をブラウザー上に作る
steelydylan
1
2.5k
複数ピンをまとめて表示するYahoo!地図用のJavaScriptライブラリをつくりま作りました
steelydylan
1
1.2k
Nuxtでのサーバー、クライアント間データ共有について
steelydylan
0
950
a-blog cmsの静的書き出し機能を使って、 自分のブログを100%静的にした話
steelydylan
0
410
MySQLの GEOMETRY 型とJavaScriptの Geolocation API の活用事例
steelydylan
1
500
アップルップルの新しいオープンソースの紹介
steelydylan
0
530
a-blog cms をよくするために 取り組んだ3つのこと
steelydylan
0
600
Other Decks in Programming
See All in Programming
ThorVG Viewer In VS Code
nors
0
660
CSC307 Lecture 01
javiergs
PRO
0
670
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
160
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
340
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
110
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
180
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
220
AIエージェントの設計で注意するべきポイント6選
har1101
6
3.1k
AtCoder Conference 2025
shindannin
0
930
CSC307 Lecture 02
javiergs
PRO
1
760
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
2
880
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.1k
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
0
200
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
140
How to build a perfect <img>
jonoalderson
1
4.8k
[SF Ruby Conf 2025] Rails X
palkan
0
710
Measuring & Analyzing Core Web Vitals
bluesmoon
9
730
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
120
How to Talk to Developers About Accessibility
jct
1
97
Unsuck your backbone
ammeep
671
58k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
370
Discover your Explorer Soul
emna__ayadi
2
1k
Evolving SEO for Evolving Search Engines
ryanjones
0
98
Accessibility Awareness
sabderemane
0
35
Transcript
next.jsを使ったuniversal React入門
自己紹介
自己紹介 @steelydylan React, TypeScript が大好きなフロントエンドエンジニア
目次 Universal JavaScriptとは Reactを使う場合 next.jsがオススメの理由 next.js 説明 next.js高度な使い方 netlifyとは netlifyとの連携
lambda functionとは netlifyの lambda function の利用
Universal JavaScriptとは フロントエンド、サーバーサイドに左右されず一貫して動くJavaScript のこと
Reactの場合 Express.js next.js
Next.jsがおすすめ 理由 TypeScriptを使いやすい フロントエンドとサーバーサイドで処理をわけやすい
next.jsがおすすめ $ npm install --save next react react-dom
next.jsがおすすめ { "scripts": { "dev": "next", "build": "next build", "start":
"next start" } }
next.jsがおすすめ ./pages/index.js を作成し、 export default () => <div>Welcome to next.js!</div>
next.jsがおすすめ これだけ!
next.js高度な設定 TypeScriptを利用 styled‑componentをSSRする
TypeScriptを利用 Babelのpresetを下記のように記述 .babelrc "presets": [ "next/babel", "@zeit/next-typescript/babel" ], next.config.js const
withTypescript = require('@zeit/next-typescript') const withCSS = require('@zeit/next-css') module.exports = withTypescript(withCSS());
styled‑componentをSSR .babelrc "plugins": [ [ "styled-components", { "ssr": true, "displayName":
true, "preprocess": false } ] ]
netlifyとは 静的サイトを簡単に公開することができるサイト gitとの連携が容易で、pushされた時のビルドコマンドを指定することが できる! npm run build など
netlifyとの連携 package.json "scripts": { "build": "next build && npm run
lambda" }
lambda function とは サーバーを必要とせず、必要時にのみ関数を実行できるもの Node.jsなどの言語にも対応している。
netlifyの lambda function の利用 npm install netlify-lambda --save-dev
netlifyの lambda function の利用 package.json "scripts": { "lambda": "netlify-lambda build
functions", "lambda-local": "netlify-lambda serve functions", }
netlifyの lambda function の利用 netlify.tomlの作成 [build] command = "npm run
export" publish = "out" functions = "lambda"
netlifyの lambda function の利用 記述例 exports.handler = async (event, context,
callback) => { return callback(null, { statusCode: 200, headers: { 'Content-type': 'application/json' }, body: JSON.stringify({ test: 'hoge' }) }); };
netlifyの lambda function の利用 run.jsという名前で作成した場合、下のURLでアクセス可能 https://example.com/.netlify/functions/run
実際のgithubレポジトリ https://github.com/steelydylan/next‑starter‑kit