1.

Explain with an example how to set the initial state in Redux.

Answer»

In ORDER to set the initial state in Redux, we have to pass the initial state as the SECOND argument to createStore as shown below:

 const rootReducer = combineReducers({ TODOS: todos, visibilityFilter: visibilityFilter});const initialState = { todos: [{id:100, name:'ritik', COMPLETED: true}]};const store = createStore( rootReducer, initialState);


Discussion

No Comment Found