Skip to content

albertstill/react-top-to-bottom

 
 

Repository files navigation

A vanilla and minimalist universal React server that mounts JSX into the entire DOM

A small example of how you could build a universal React app using vanilla React and the new React Router v4.

I mount React at the document so you use can use JSX the whole way down. No server template engine or html string interpolation needed. You also control the head content with React, therefore no document head manager such as react-helmet is needed.

Server side props are embedded into the server rendered HTML using JSX itself.

The transpiling of the React code for server side rendering is performed by babel-register, there is no server side bundle, and I only transpile the JS I have to.

One caveat with mounting at the document level could be 3rd party JS libraries needing to manipulate the DOM such as browser extensions or Google Analytics.

About

A vanilla and minimalist universal React server that mounts JSX at the document level

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.5%
  • CSS 0.5%