I'm seeing something unexpected in this code example here: https://codesandbox.io/s/react-redux-application-forked-lb7zk?file=/src/pages/DashboardPage.js:415-452
I'm logging the change of the x
variable (that comes from redux state).
I dispatch 2 actions that would cancel each other:
x
starts as 1- first dispatch changes it to:
x=2
- second dispatch changes it back to:
x=1
I was expecting to see 3 console.logs, one for the initial render, and two more for each change described above. But instead I'm only getting 1, the one for the initial render. It seems that since they all happen in a sudden, redux seems to batch the actions so the state doesn't really changes in this case.
This really makes me doubt, I'd like to understand what's going on., Is this what's going on?