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
290
エディター付きのReact開発環境を ブラウザーだけで実装した話
steelydylan
9
2.1k
HonoでReact・TypeScriptの実行環境をブラウザー上に作る
steelydylan
1
2.7k
複数ピンをまとめて表示するYahoo!地図用のJavaScriptライブラリをつくりま作りました
steelydylan
1
1.3k
Nuxtでのサーバー、クライアント間データ共有について
steelydylan
0
1k
a-blog cmsの静的書き出し機能を使って、 自分のブログを100%静的にした話
steelydylan
0
450
MySQLの GEOMETRY 型とJavaScriptの Geolocation API の活用事例
steelydylan
1
540
アップルップルの新しいオープンソースの紹介
steelydylan
0
570
a-blog cms をよくするために 取り組んだ3つのこと
steelydylan
0
650
Other Decks in Programming
See All in Programming
ソフトウェアラスタライザ
fadis
1
800
新卒PdEのリアル
ryu1013
1
480
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
350
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
150
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
150
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
230
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
490
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
信頼性の目標を誰も求めてない
shubox
0
500
ALB ログから Trace を気合で繋げる技術
fohte
7
880
Intent as Code
shoppingjaws
6
770
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
240
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Visualization
eitanlees
152
17k
Being A Developer After 40
akosma
91
590k
Thoughts on Productivity
jonyablonski
76
5.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Typedesign – Prime Four
hannesfritz
42
3.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
880
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
From π to Pie charts
rasagy
0
360
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