Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
310
エディター付きのReact開発環境を ブラウザーだけで実装した話
steelydylan
9
2.1k
HonoでReact・TypeScriptの実行環境をブラウザー上に作る
steelydylan
1
2.8k
複数ピンをまとめて表示するYahoo!地図用のJavaScriptライブラリをつくりま作りました
steelydylan
1
1.4k
Nuxtでのサーバー、クライアント間データ共有について
steelydylan
0
1k
a-blog cmsの静的書き出し機能を使って、 自分のブログを100%静的にした話
steelydylan
0
460
MySQLの GEOMETRY 型とJavaScriptの Geolocation API の活用事例
steelydylan
1
540
アップルップルの新しいオープンソースの紹介
steelydylan
0
570
a-blog cms をよくするために 取り組んだ3つのこと
steelydylan
0
660
Other Decks in Programming
See All in Programming
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
120
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
320
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
210
Vue Fes Japan の “作る側”に関わってみて
naokihaba
1
190
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
150
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
170
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
7k
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
110
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.2k
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
220
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
180
残高管理から台帳サービスへの進化
artoy
1
210
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
540
Done Done
chrislema
187
17k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
How to Ace a Technical Interview
jacobian
280
24k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
650
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Mind Mapping
helmedeiros
1
410
Fireside Chat
paigeccino
43
4.1k
Chasing Engaging Ingredients in Design
codingconduct
0
370
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
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