Closed giannif closed 5 years ago
well it is supposed to guard against async setState firing on a dead/unmounted component. It looks like the hoc wants to setState before the inner component is mounted? PRs welcome of course!
@drcmda created a PR for this, setting an unmounted
flag instead of a mounted
flag, which isn't required for setState
. I've done unmounted
to avoid setState
errors a few times before
@drcmda working wonderfully after the patch, thanks!
A child component wrapped with
hoc
can't invoke setState incomponentDidMount
because this.mounted is false.I have a codesandbox demonstrating this, an action is invoked in
componentDidMount
, but thesetState
will not execute. https://codesandbox.io/s/9zonjjq3k4If you have any ideas, I'm up for doing a pr. I'm not exactly sure why the
this.mounted
check is requiredGreat lib though :)