Skip to content

Instantly share code, notes, and snippets.

@alexnm
Created March 24, 2018 16:32
Show Gist options
  • Save alexnm/9fc6248dfa3648d588e862ddb962cee7 to your computer and use it in GitHub Desktop.
Save alexnm/9fc6248dfa3648d588e862ddb962cee7 to your computer and use it in GitHub Desktop.
The client file for handling redux with react ssr
import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter as Router } from "react-router-dom";
import { Provider as ReduxProvider } from "react-redux";
import Layout from "./components/Layout";
import createStore from "./store";
const store = createStore( window.REDUX_DATA );
const jsx = (
<ReduxProvider store={ store }>
<Router>
<Layout />
</Router>
</ReduxProvider>
);
const app = document.getElementById( "app" );
ReactDOM.hydrate( jsx, app );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment