Closed morenoh149 closed 9 years ago
I think it's because state managed by userReducer
is an object, but itemsReducer
manages an array.
(I agree explaining it beforehand would be a good idea.)
Yes it's actually because the initial state of the userReducer is an object {}
(https://github.com/happypoulp/redux-tutorial/blob/master/06_combine-reducers.js#L53) but the initial state of the itemsReducer is an array []
(https://github.com/happypoulp/redux-tutorial/blob/master/06_combine-reducers.js#L62). I thought it would be a good way to demonstrate that the state held by Redux is really made of the slices of state that each reducer returns. I'll make it more clear :).
Done: https://github.com/happypoulp/redux-tutorial/commit/b04c8b8cc535b61b0d7008c7a2586a71e5f7431d , hope it's more clear now.
Could you explain why the initial reducer shows
{}
but the subsequent ones recieve[]
https://github.com/happypoulp/redux-tutorial/blob/master/06_combine-reducers.js