May 2019
Intermediate to advanced
496 pages
10h 38m
English
Since we're done scaffolding, let's finally update src/index.js to load Redux at runtime.
Add the following two imports to the top of the file:
import { Provider } from 'react-redux';import { configureStore } from './store';
Then wrap the existing JSX in a Provider component, as shown. This is how all our components will gain access to the Redux store. As we'll see later, when we test Redux-enabled components, we'll also need to wrap them in Provider components, within our test suites.
Within the production code, however, we just need one that wraps the root component:
ReactDOM.render( <Provider store={configureStore()}> <Router history={appHistory}> <Route path="/" component={App} /> </Router> </Provider>, document.getElementById('root') ...Read now
Unlock full access