in React JS by
Q:

 How to set initial state in Redux?

► Click here to show 1 Answer

0 votes
by

You need to pass initial state as second argument to createStore

const rootReducer = combineReducers({
  todos: todos,
  visibilityFilter: visibilityFilter
});

const initialState = {
  todos: [{id:123, name:'sudheer', completed: false}]
};

const store = createStore(
  rootReducer,
  initialState
);
React JS
Learn More with Madanswer

Related questions

0 votes
asked Jun 19, 2020 in React JS by JackTerrance
...