Infinite Builder
71,000 React devs
App.js
/page
index.js
about.js
index.html
about.html
App.js
/page
index.js
about.js
index.html
about.html
/content
1776-07-04-nothing-much-happened-today.md
1963-08-28-i-have-a-dream.md
blog.js
blog/1776-07-04-nothing-much-happened-today
blog/1963-08-28-i-have-a-dream
/template
Why is this desirable?
single js bundle approach
App.js
/page
index.js
about.js
index.html
about.html
/content
1776-07-04-nothing-much-happened-today.md
1963-08-28-i-have-a-dream.md
blog.js
blog/1776-07-04-nothing-much-happened-today
blog/1963-08-28-i-have-a-dream
/template
bundle.js
// instead of
ReactDOM.render(element, container)
// you do this on the server
import ReactDOMServer from 'react-dom/server'
ReactDOMServer.renderToString(element)
// then this in the client
ReactDOM.hydrate(element, container)
App.js
/page
index.js
about.js
index.html
about.html
/content
1776-07-04-nothing-much-happened-today.md
1963-08-28-i-have-a-dream.md
blog.js
blog/1776-07-04-nothing-much-happened-today
blog/1963-08-28-i-have-a-dream
/template
bundle.js
App.js
/page
index.js
about.js
index.html
about.html
/content
1776-07-04-nothing-much-happened-today.md
1963-08-28-i-have-a-dream.md
blog.js
blog/1776-07-04-nothing-much-happened-today
blog/1963-08-28-i-have-a-dream
/template
bundle.js
chunk1.js
chunk2.js
chunk3.js
chunk4.js
App.js
/page
index.js
about.js
index.html
about.html
/content
1776-07-04-nothing-much-happened-today.md
1963-08-28-i-have-a-dream.md
blog.js
blog/1776-07-04-nothing-much-happened-today
blog/1963-08-28-i-have-a-dream
/template
bundle.js
chunk1.js
chunk2.js
chunk3.js
chunk4.js
App.js
/page
index.js
about.js
index.html
about.html
/content
1776-07-04-nothing-much-happened-today.md
1963-08-28-i-have-a-dream.md
blog.js
blog/1776-07-04-nothing-much-happened-today
blog/1963-08-28-i-have-a-dream
/template
bundle.js
chunk1.js
chunk2.js
data1.json
chunk3.js
data2.json
https://developers.google.com/web/fundamentals/performance/prpl-pattern/
App
Data
Gatsby
Plugins
Your Site
React 16
Webpack 4
Babel 7
@reach/router
import React from "react"
import { StaticQuery, graphql } from "gatsby"
export default () => (
<StaticQuery
query={graphql`
query HeadingQuery {
site {
siteMetadata {
title
}
}
}
`}
render={data => (
<header>
<h1>{data.site.siteMetadata.title}</h1>
</header>
)}
/>
)
Client
Server
Client
Server
Clientside SPA
Server Side Rendering
⚒️
⚒️
😢
😃
⚒️
⚒️
CDN
Github
AOT Rendering = JAMStack
⚒️
Client
🤷♂️
😃