Created
March 24, 2018 16:32
-
-
Save alexnm/9fc6248dfa3648d588e862ddb962cee7 to your computer and use it in GitHub Desktop.
The client file for handling redux with react ssr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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