To understand it more deeply you need to learn about combineReducers
Example
rootReducer = combineReducers({potato: potatoReducer, tomato: tomatoReducer})
// This would produce the following state object
{
potato: {
// ... potatoes, and other state managed by the potatoReducer ...
},
tomato: {
// ... tomatoes, and other state managed by the tomatoReducer, maybe some nice
// sauce? ...
}
}
You can control state key names by using different keys for the reducers in the passed object. For example, you may call combineReducers({ todos: myTodosReducer, counter: myCounterReducer })
for the state shape to be { todos, counter }
.
A popular convention is to name reducers after the state slices they manage, so you can use ES6 property shorthand notation: combineReducers({ counter, todos })
. This is equivalent to writing combineReducers({ counter: counter, todos: todos })
.
So when you are using ...state.list
you are getting it because of combineReducers({ list: listReducer })
or simply combineReducers({ list})
To know more please follow: combineReducers