[Redux] Expected the reducer to be a function
If you see Error: Expected the reducer to be a function.
message when you call createStore
to create store.
Check out the second argument of createStore
. It must be a function.
// Error
const store = createStore(rootReducer, composeWithDevTools);
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<App />
</Provider>
</React.StrictMode>,
document.getElementById('root'),
// Correct
const store = createStore(rootReducer, composeWithDevTools());
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<App />
</Provider>
</React.StrictMode>,
document.getElementById('root'),
Comments