Closed titouancreach closed 6 years ago
It happens because when the store is updated we call:
this.state = mapStateToProps(this.store.getState());
if mapStateToProps has for example something like:
const mapStateToProps = props => state => ({
foo: getFooById(props.id)
});
getFooById
will fail since props.id
is still 0 until re-rendering.
The solution is to call mapStateToProps
during rerendering.
Imagine a store
and the component Foo:
If a "foo" is deleted from the store,
<Foo id={0} />
is still here until the rerendering. It cause this component to be wrong during some milliseconds.