This code used to work in react-redux v7.1.0
This is my demo.
https://codesandbox.io/s/trusting-sun-07mrh
const todo = useSelector(state => state.todo); not re-render
const todo = useSelector(state => state.todo , () => {}); it's re-render
You're mutating in the reducer:
case "add":
const { todo } = state;
todo.push(action.payload);
return Object.assign({}, state, { ...state, todo });
That is not a proper immutable update. Don't do that :)
I'd encourage you to ]use the configureStore() function from Redux Starter Kit](https://redux-starter-kit.js.org/api/configureStore), which will throw errors when you mutate.
Most helpful comment
You're mutating in the reducer:
That is not a proper immutable update. Don't do that :)
I'd encourage you to ]use the
configureStore()function from Redux Starter Kit](https://redux-starter-kit.js.org/api/configureStore), which will throw errors when you mutate.