Wrapping with the Provider component

First, remove the store.subscribe call from src/index.jsx. We no longer need this as connect will take care of subscribing to changes to the state. This also means we no longer need to wrap our ReactDOM.render call inside a function.

Next, since we will be calling connect within each component, there’s no need to pass the store and the state properties as props. Therefore, in our <Route> components, switch back to using the component prop instead of render.

Most importantly, wrap our entire application with the <Provider> component, passing the store as its only prop:

import { Provider } from 'react-redux'; ReactDOM.render((   <Provider store={store}>     <BrowserRouter>       <Switch> <Route exact path="/register" ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.