Now, we will initialize the Redux store to be able to use it when rendering our components:
- First, we need to import the Provider component from react-redux to be able to connect our application to the Redux store:
import { Provider } from 'react-redux'
- We call the initStore function and pass the store variable to it:
return initStore(store)
- The initStore function returns a promise, so we can use .then() to define a handler function:
.then(() => {
- Now that the Redux store is initialized, we can use the renderToString function to render our application:
const markup = renderToString(
- Finally, we use the <Provider> component and pass the store variable to it in order to make the store available to our ...