Categories

Jun 19 in React JS
Q:

 How to set initial state in Redux?

1 Answer

Jun 19

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
);
Click here to read more about React JS
Click here to read more about Insurance

Related questions

Madanswer
Jun 19 in React JS
Jun 19 in React JS
Jul 2, 2019 in React JS
...