/node-server-render-react

An example of a node server rendering a React app

Primary LanguageJavaScript

An example of how to server render React components

The main inspirations were Next.js and Axios Hook's caching mechanism. Similar to Next's getInitialProps, I used a higher order component (HOC), to create a component that can be rendered on both client and server, with no direct knowledge of it needed by the component developer.

The server is run with yarn start (or npm), and that renders the App component in app.js and serves up src/index.js as the client side entry point for hydration.

This is a build out of an initial sketch here.

Research

Gatsby

Next

Get initial props

Razzle

Babel example node server

Ajax request completion via axios hooks

Typescript and node

Prerender with Puppeteer