/index.jsp
/product.jsp?id=1234
Pros
Cons
/index.html
/product?id=1234
Pros
Cons
yarn add next react react-dom
{
...
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
}
...
}
yarn dev
/root
/pages
helloWorld.jsx
(Put your "page" files here)
export default () => <h1>Hello Next.js</h1>;
helloWorld.jsx
Routing
Data loading
User experience
http://localhost:5005/products
const Product = ({ product }) => l
<div>
<h1>{product.name}</h1>
</div>
):
export async function getServerSideProps(context) {
const res = await fetch('http://localhost:5005/products/1') ;
const product = await res.json();
return { product };
}
export default Product;
Switches between unfetch & node-fetch for client & server.
If the loading indicator is shown,
show it for a minimum amount of time
Wait 200ms for the data to load
before displaying the loading indicator
AMP
Dynamic import
Static exports
CSS in JS
Lambda per page deployments
next-offline PWA
mattruby@gmail.com