This example is the todo list borrowed from the react.js main page. We render the application server-side using express-react-views. An initial set of items has been added to illustrate populating data from the server.
npm install
npm start
-
Separate the page into two templates, a static container component and a dynamic inner component.
-
Use express-react-views to render and serve the container. Server-side data can be sent via view options.
-
Make your views available client-side as javascript. Here I created a main function for bootstrapping and packaged it up using browserify.
-
Initialize the client-side app into the dynamic component using the same data from the server-side. This example passes the initial data to the client as the argument of the main function. Be mindful of potential XSS vulnerabilities.