Reputation: 1369
Sandbox Link to reproduce this issue: https://codesandbox.io/s/redux-component-store-issue-kegqo
Upvotes: 1
Views: 21
Reputation: 1369
Sandbox Link issue fixed: https://codesandbox.io/s/fix-redux-component-store-issue-j7oxb?file=/src/redux/reducers/userReducer.js
const userReducer = (state=initialState, actions) => {
switch(actions.type) {
case UPDATE_USERS:
return {...state, users: [...actions.payload.users]}
default:
return {...state}
}
}
In the react reducer, for array use [...Array], for the object use {...object}
Upvotes: 1