Reputation: 864
I am fairly new to react-redux
and I am getting this wierd error. It says that my rootReducer
is not defined. rootReducer
is the constant that I create after I combine my reducers. This is my code:
import {combineReducers} from 'redux';
import taskReducer from './handle-action';
rootReducer = combineReducers({
tasks: taskReducer
});
export default rootReducer;
What am I missing?
Upvotes: 2
Views: 7945
Reputation: 726
Whatever you export must be a variable or function so it should be const or var or let
import {combineReducers} from 'redux';
import taskReducer from './handle-action';
const rootReducer = combineReducers({
tasks: taskReducer
});
export default rootReducer;
Upvotes: 2
Reputation: 7983
You missed to define a rootReducer
variable
const rootReducer = combineReducers({ tasks: taskReducer });
or
export default combineReducers({ tasks: taskReducer });
Upvotes: 2