dinosaur
dinosaur

Reputation: 199

Store does not have a valid reducer?

This is first time i'm working with React and Redux. I haven't able to find error around it.

"webpack-internal:///./node_modules/react-error-overlay/lib/index.js:1446 Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers."

This is reducer:

import { combineReducers } from 'redux';

const rootReducer = combineReducers({});

export default rootReducer;

Upvotes: 1

Views: 1242

Answers (1)

Roy.B
Roy.B

Reputation: 2106

If the object is empty.

const rootReducer = combineReducers({});

This error will show.

add some data in it like:

import { combineReducers } from 'redux';
import foo from '../foo' //this is your reducer

const rootReducer = combineReducers({foo});
export default rootReducer;

reducer example

//reducer/foo.js
export default function foo(state = null, action) {
     switch (action.type) {
         case 'MY_ACTION_TYPE':
           return action.payload
     }
     return state;
 }

Upvotes: 3

Related Questions