Skip to content

Simple POC to test React server side rendering capabilities and code sharing

Notifications You must be signed in to change notification settings

pirelenito/react-server-side-rendering-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Server Side Rendering POC

Simple POC to test React server side rendering capabilities and code sharing.

I've used the node-jsx module to seamlessly require jsx modules.

var home = require('./app/home.jsx');

Usage

Start the server

npm start

Run the (stupid) benchmark

npm test

Using JSX as views

It is possible to use express-react-views to handle the JSX as views (althogh it still have the same problem of requiring server restart to reflect changes in the views code). Might be an option, although it limits its use as real components in the client.

Drawbacks

  • Any change in the code of the views/components require a server restart to be applied. Something that can be easily resolved using something like supervisor.
  • It is probably going to be impossible to have a React component using a underlying jQuery component in this situation, since we don't have the DOM in the server.
  • You change the common pattern of requiring a module without an extension (you need to add jsx).

References

About

Simple POC to test React server side rendering capabilities and code sharing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published