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
Universal and Progressive Web Apps with ReactJS
Search
Mike Bild
November 26, 2017
Programming
57
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Universal and Progressive Web Apps with ReactJS
Mike Bild
November 26, 2017
More Decks by Mike Bild
See All by Mike Bild
Introduction Data-Apps with Python
mikebild
0
120
Python & Pandas in a Nutshell
mikebild
0
260
Data Management with GraphQL
mikebild
2
160
Functions-as-a-Service with Linklet
mikebild
2
340
Other Decks in Programming
See All in Programming
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
150
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.2k
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
190
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
120
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.4k
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
200
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
240
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
310
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
200
オーケストレーション記述言語 Katari
yukikurage
0
200
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
7k
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
110
Featured
See All Featured
Claude Code のすすめ
schroneko
67
230k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
640
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Building an army of robots
kneath
307
47k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
960
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
340
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
590
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Transcript
REACT JS UNIVERSAL WEB APP
UNIVERSAL WEB APP + REACTJS TODAY ▸ Web-Development ▸ Universal
Web Apps + ReactJS ▸ Demo ▸ Resources ▸ Bonus
UNIVERSAL WEB APP + REACTJS DECADES OF WEB-DEVELOPMENT ▸ Server
Side Rendering ▸ Single Page Apps ▸ Universal Web Apps ▸ Progressive Web Apps ▸ Demo
UNIVERSAL WEB APP + REACTJS SERVER-SIDE-RENDERING (CLASSIC) ▸ Facebook, GitHub
etc. - great success stories ▸ Perl / PHP / Rails & more MVC Frameworks ▸ Many Round-Trips ▸ Mixed Code & Structure
UNIVERSAL WEB APP + REACTJS SINGLE PAGE APP (CLIENT RENDERING)
Empty index.html <script src> </script> JS React execution Page interaction
UNIVERSAL WEB APP + REACTJS SPA - RECAP ▸ SEO
▸ Routing ▸ JavaScript / Web Security ▸ Initial data fetching ++ - - ▸ Logged in User Context ▸ Static WebSite Deployment ▸ Scalability
UNIVERSAL WEB APP + REACTJS UNIVERSAL WEB APP (SERVER +
CLIENT RENDERING) SSR <script src> </script> JS React execution Page interaction
UNIVERSAL WEB APP + REACTJS UWA - RECAP ▸ Slower
Time To First Byte ▸ Server Runtime ▸ Scalability ++ - - ▸ Logged out User Context ▸ Rendered earlier ▸ Less page flicker ▸ JavaScript / Web Security
UNIVERSAL WEB APP + REACTJS NEXT? PROGRESSIVE WEB APPLICATIONS ▸
HTTPS + Service-Worker ▸ Faster content more reliable (prefetch, cache, offline) ▸ Environment integration (Homescreen, Push-Notifications) ▸ Tooling (Googles Lighthouse) ▸ Browsers?
UNIVERSAL WEB APP + REACTJS @REACT16 + SERVER SIDE RENDERER
▸ Simplified and more Efficient ▸ ReactDOM.hydrate - no checksum markup validation ▸ ReactDOM.renderToNodeStream - async Renderer
UNIVERSAL WEB APP + REACTJS UWA FLOW Shared JavaScript /
ES6 / ES7 ReactJS Component ./dist/client.js WebPack.Client.Config NodeJS router.get(/, …) {renderToString} from 'react-dom/server' index.html WebPack.Server.Config {renderToNodeStream} from 'react-dom/server' @REACT15 / @REACT16
UNIVERSAL WEB APP + REACTJS NEXT? PROGRESSIVE WEB APPLICATIONS PREFETCH
RESOURCES CACHE ASSETS OFFLINE ACCESS PUSH NOTIFICATIONS
UNIVERSAL WEB APP + REACTJS RESOURCE PREFETCH + CACHE ASSETS
var CACHE_NAME = 'pwa-cache-v__TIMESTAMP__'; self.addEventListener('activate', event => { var cacheWhitelist = [CACHE_NAME]; event.waitUntil( caches.keys().then(keyList => Promise.all( keyList.map(key => { if (!cacheWhitelist.includes(key)) { console.log(`Deleting cache: ${key}`); return caches.delete(key); } }) ) ) ); }); self.addEventListener('install', event => { event.waitUntil( caches.open(CACHE_NAME).then(cache => fetch('assets-manifest.json', {headers: {'Content-Type': 'application/json'}}) .then(res => res.json()) .then(assets => cache.addAll(assets)) .then(() => console.log('Cached')) ) ); }); self.addEventListener('fetch', function(event) { event.respondWith(caches.match(event.request).then(response => response || fetch(event.request))); }); CACHE TIMESTAMP SERVICE WORKER
UNIVERSAL WEB APP + REACTJS ASSETS-MANIFEST (JSON) [ "/", "/main.js",
"/main.css", "/logo.png", "https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,300,400italic,600,200,600italic,700,900", "https://fonts.gstatic.com/s/sourcesanspro/v10/ODelI1aHBYDBqgeIAH2zlJbPFduIYtoLzwST68uhz_Y.woff2", "https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGJkF8H8ye47wsfpWywda8og.woff2", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css", "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/fonts/fontawesome-webfont.woff2?v=4.6.3", "https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css" ] CONFIGURABLE ASSET AND RESOURCE LIST
UNIVERSAL WEB APP + REACTJS PWA-APP-MANIFEST { "name": "UWA-PWA", "short_name":
"UWA-PWA", "start_url": "/?homescreen=1", "display": "standalone", "theme_color": "aliceblue", "background_color": "gray", "description": "My React-Universal-App", "icons": [{ "src": "homescreen.png", "sizes": "48x48", "type": "image/png" }], "related_applications": [{ "platform": "web", "id": "UWA-PWA" }] } ADD TO HOMESCREEN SPLASHSCREEN
UNIVERSAL WEB APP + REACTJS SERVER import express from 'express'
const app = express() app.use(express.static(__dirname + '/statics')) app.listen(8080, () => console.log(`Listen on 8080`)) NODEJS + EXPRESSJS + @REACT15 / REACT16
UNIVERSAL WEB APP + REACTJS COMPONENTS import React from 'react'
export default class HelloWorld extends React.PureComponent { render() { return ( <div>Hello, {this.props.greeting}</div> ) } } @REACT15 / @REACT16
UNIVERSAL WEB APP + REACTJS SERVER + REACT import React
from 'react' import {renderToString} from 'react-dom/server' import HelloWorld from ‚../components/HelloWorld' app.get('/', (req, res) => { const initialData = 'Universal Web App' const html = renderToString(<HelloWorld />) res.send(renderUniversalPageWithData(html, initialData)) }) @REACT15
UNIVERSAL REACTJS SERVER HTML TEMPLATE function renderUniversalPageWithData(html, initialData) { return
( `<html> <head lang="de"> <meta charset="UTF-8"> <title>ReactJS SSR</title> </head> <body> <div id="root">${html}</div> </body> <script> window.__INITIAL_STATE__ = ${JSON.stringify(initialData)}; </script> <script src="/bundle.js"></script> </html>` ) } @REACT15
UNIVERSAL WEB APP + REACTJS SERVER + REACT import React
from 'react' import {renderToNodeStream} from 'react-dom/server' import HelloWorld from '../components/HelloWorld' app.get('/', (req, res) => { renderToNodeStream( <Html initialData={JSON.stringify(initialData)}> <HelloWorld {...initialData} /> </Html> ).pipe(res); }) @REACT16
UNIVERSAL REACTJS SERVER HTML TEMPLATE import React from 'react' const
Html = props => ( <html> <head> <title>ReactJS SSR</title> </head> <body> <div id="root">{props.children}</div> <script id="initial-data" type="text/plain" data-json={props.initialData} /> <script src="/bundle.js" /> </body> </html> ) export default Html @REACT16
UNIVERSAL WEB APP + REACTJS CLIENT import React from 'react'
import {render} from 'react-dom' import HelloWorld from ‚../components/HelloWorld' const initialData = window.__INITIAL_STATE__ render( <HelloWorld {...initialData} />, document.getElementById('root') ) @REACT15
UNIVERSAL WEB APP + REACTJS CLIENT import React from 'react'
import {hydrate} from 'react-dom' import HelloWorld from '../components/HelloWorld' const initialData = JSON.parse( document.getElementById('initial-data').getAttribute('data-json') ) hydrate( <HelloWorld {...initialData} />, document.getElementById('root') ) @REACT16
UNIVERSAL WEB APP + REACTJS UWA + REACT ROUTER4 ▸
Server - StaticRouter ▸ Client - BrowserRouter ▸ Routes
UNIVERSAL WEB APP + REACTJS THANK YOU! QUESTIONS SOFTWARE ENGINEER
// FREELANCER // WORKSHOPS @MIKEBILD @MIKEBILD ASK ME ABOUT UWA & PWA
UNIVERSAL WEB APP + REACTJS RESOURCES ▸ Reunify UWA +
PWA https://www.reunify.run ▸ Reunify Code and Issues on GitHub https://github.com/CodeCommission/reunify ▸ Reunify News on Twitter https://twitter.com/reunify_run