Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

How Do I Get Started?

Slide 6

Slide 6 text

A brief introduction to Next.js React Made Easy and Simple Yos Riady yos.io goo.gl/RojVMa

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

● Server-rendered by default (better SEO) ● Automatic code splitting & lazy loading for faster page loads ● Simple client-side routing (page based) ● Webpack-based dev environment which supports Hot Module Replacement ● Able to implement with Express or any other Node.js HTTP server ● Customizable with your own Babel and Webpack configurations Next.js Features

Slide 9

Slide 9 text

https://github.com/yosriady/hello-next

Slide 10

Slide 10 text

Shared Components Project setup Client-side navigation Setup Navigation Sharing Dynamic Server Fetching data Dynamic content

Slide 11

Slide 11 text

Getting Started

Slide 12

Slide 12 text

Getting Started: What We Learned ● Setting up is simple and fast ● Comes baked in with helpful development features ○ Error handling ○ Hot Module Replacement ● Create a page by exporting a React component in pages/ ○ Pages = Top-level components ○ Use the filesystem as an API

Slide 13

Slide 13 text

Navigation

Slide 14

Slide 14 text

● Use Link to do client-side routing ● Built-in client-side history support!! ● Code splitting, components are lazy loaded per page ● Prefetching pages with Link prefetch! (not shown) ○ Lazy Load components ahead of time ○ Great initial load performance of a website ○ Ahead-of-time download capabilities of an app Navigation: What We Learned

Slide 15

Slide 15 text

Shared Components

Slide 16

Slide 16 text

● Use shared components in your pages! ○ Common Headers, ○ Layouts, etc. ● Import components from NPM modules and use them (Link) Shared Components: What We Learned

Slide 17

Slide 17 text

Dynamic Pages

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

● Dynamic pages with query strings ● Passing data through components with props ○ Page props ○ Parent component props ● Route masking Dynamic Pages: What We Learned

Slide 20

Slide 20 text

Server Side Support

Slide 21

Slide 21 text

Server Side Support: What We Learned ● Extend routing functionality with a Node.js server ○ Access request object ○ Extend default Next.js handler ○ Custom routes

Slide 22

Slide 22 text

Fetching Data

Slide 23

Slide 23 text

Fetching Data: What We Learned ● Fetch component data in getInitialProps ○ Isomorphic fetching (!) ● When we render the page on the server, ○ Fetch happens on the server ● When we navigate via client-side ○ Fetch happens on the client

Slide 24

Slide 24 text

Shared Components Project setup Client-side navigation Setup Navigation Sharing Dynamic Server Fetching data Dynamic content

Slide 25

Slide 25 text

In Closing ● Next.js makes it easy for you to get started with React. ● Give it a try! Especially if: ○ You’re new to the React ecosystem ○ You need an SSR application ○ You just want to get things done

Slide 26

Slide 26 text

Thanks Yos Riady yos.io

Slide 27

Slide 27 text

Questions? Yos Riady yos.io

Slide 28

Slide 28 text

A brief introduction to Next.js React Made Easy and Simple Yos Riady yos.io goo.gl/RojVMa