Closed joshjg closed 5 years ago
Currently, there is a timing issue when children dispatch an action inside useEffect during their first render. Here's the order of events:
useEffect
useMapState
As a result, consumers are not updated with the new state value. Here's how react-redux handles this: https://github.com/reduxjs/react-redux/blob/72ed6db1947913bdd4900b324243c43a490b4c5a/src/components/Provider.js#L56
Thanks for bringing this up. Will look into it.
Fix released in v0.5.4
Currently, there is a timing issue when children dispatch an action inside
useEffect
during their first render. Here's the order of events:useMapState
useEffect
useEffect
As a result, consumers are not updated with the new state value. Here's how react-redux handles this: https://github.com/reduxjs/react-redux/blob/72ed6db1947913bdd4900b324243c43a490b4c5a/src/components/Provider.js#L56