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
Isomorphic Web Apps with React
Search
Kristian Andersen
February 25, 2016
Programming
57
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Isomorphic Web Apps with React
Kristian Andersen
February 25, 2016
More Decks by Kristian Andersen
See All by Kristian Andersen
Flexbox all the things
ksmandersen
2
170
Static Websites with Gulp & AWS
ksmandersen
0
140
Practical MVVM
ksmandersen
0
230
Practical Swift
ksmandersen
1
220
Introduction to CocoaLumberjack
ksmandersen
0
130
Other Decks in Programming
See All in Programming
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
1k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
22
22k
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.4k
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
Event is what happens
moro
2
520
contenteditable と日本語入力に向き合う
colorful12
0
190
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
210
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
16k
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
110
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Being A Developer After 40
akosma
92
590k
Paper Plane
katiecoart
PRO
5
54k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
520
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Balancing Empowerment & Direction
lara
6
1.3k
Building Applications with DynamoDB
mza
96
7.2k
Transcript
@CPHFRONT ⎯ @KSMANDERSEN
ISOMORPHIC WEB APPS
IN THE BEGINNING
AND THUS JAVASCRIPT WAS BORN
THE CRAZY ENGINEERS @ GOOGLE
LET'S RUN JAVASCRIPT ON SERVERS
ISOMORPHIC WEB APPS
UNIVERSAL WEB APPS
WHAT IT IS > An app that runs both on
the server and the client > Rendering can be done both by the server and the browser > The apps share at least 90% of the same code
None
None
CLIENT-SIDE RENDERING > Rendering done client-side takes load away from
the server > Consecutive page navigation is very fast > Fancy interactions, animations and rainbows
SERVER-SIDE RENDERING > More load on the server for rendering
> Page content visible to bots, search engines and crazy people > The initial page load is faster (no app to boot client- side)
ISOMORPHIC RENDERING > The best of both worlds > Fast
initial page load (server-side rendering) > Consecutive page loads are very fast (client-side rendering) > Page content visible for bots, search engines and crazy people
None
WHY IS REACT GREAT FOR ISOMORPHIC WEB APPS?
COMPONENTS COMPONENTS COMPONENTS
THE VIRTUAL DOM
await Router.dispatch({ path: req.path, query: req.query, context }, (state, component)
=> { data.body = ReactDOM.renderToString(component); });
DE-COUPLED ROUTING
const router = new Router(on => { on('*', async (state,
next) => { const component = await next(); return component && <App context={state.context}>{component}</App>; }); on('/login', async () => <LoginPage />); });
EXPRESS.JS
const server = global.server = express(); server.get('*', async (req, res,
next) => { res.status(200).send(`Hello World`); });
GREAT HOW DO I GET STARTED?
None
HOW IT ACTUALLY WORKS
None
SERVER.JS const server = global.server = express(); server.get('*', async (req,
res, next) => { try { const data = { title: '', description: '', css: [], body: '', entry: assets.main.js }; const context = { insertCss: styles => data.css.push(styles._getCss()), ... }; await Router.dispatch({ path: req.path, query: req.query, context }, (state, component) => { data.body = ReactDOM.renderToString(component); data.css = css.join(''); }); const html = ReactDOM.renderToStaticMarkup(<Html {...data} />); res.status(200).send(`<!doctype html>\n${html}`); } catch (err) { next(err); } }); server.listen(port, () => {});
DEMO TIME
@CPHFRONT ⎯ @KSMANDERSEN