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
340
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
next.jsを使ったuniversal React 入門
Hori Godai
December 14, 2018
More Decks by Hori Godai
See All by Hori Godai
TypeScript Compiler APIを使って 型のユニットテストをブラウザーで動かす
steelydylan
3
290
エディター付きのReact開発環境を ブラウザーだけで実装した話
steelydylan
9
2k
HonoでReact・TypeScriptの実行環境をブラウザー上に作る
steelydylan
1
2.6k
複数ピンをまとめて表示するYahoo!地図用のJavaScriptライブラリをつくりま作りました
steelydylan
1
1.3k
Nuxtでのサーバー、クライアント間データ共有について
steelydylan
0
990
a-blog cmsの静的書き出し機能を使って、 自分のブログを100%静的にした話
steelydylan
0
440
MySQLの GEOMETRY 型とJavaScriptの Geolocation API の活用事例
steelydylan
1
530
アップルップルの新しいオープンソースの紹介
steelydylan
0
560
a-blog cms をよくするために 取り組んだ3つのこと
steelydylan
0
650
Other Decks in Programming
See All in Programming
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
160
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
180
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
200
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
270
共通化で考えるべきは、実装より公開する型だった
codeegg
0
200
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
110
関数型プログラミングのメリットって何だろう?
wanko_it
0
160
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
280
symfony/aiとlaravel/boost
77web
0
120
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
130
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
240
【やさしく解説 設計編 #1】「ドメイン駆動」と「実装駆動」ってなに? 〜設計の考え方を、たとえ話で学ぼう〜
panda728
PRO
1
110
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
990
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
630
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.7k
Automating Front-end Workflow
addyosmani
1370
210k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
220
A Tale of Four Properties
chriscoyier
163
24k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
750
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Utilizing Notion as your number one productivity tool
mfonobong
4
370
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