jackcallister / redux-isomorphic-example

10 stars 0 forks source link

Redux Isomorphic Example

Server-side JavaScript rendering with React/Flux can be confusing. This repo is a Hello, World example of isomorphic/universal/server-side rendering/I don't care what you call it JavaScript.

Tools

This example utilises the following setup

The Routing is the hardest thing to figure out for serverside rendering, especially with the new React Router and using Redux React Router on top of it just makes it that little bit more confusing, so I'm here to help ease your pain!

How it works

First, what are we rendering? The React application has one route which displays this component <h1>{this.props.data}</h1>. The data comes from the Redux store, which looks like this behind the scenes:

{
  data: ''
}

The rendering will work like this.

Server Side

Now on the client, all together now...

Client Side