4 ms·
I use a static var on the class. componentDidMount() { if (!this.unmounted) ... } componentWillUnmount() { this.unmounted = true }
by pcmaffey 9y ago
I use a static var on the class.
componentDidMount() {
if (!this.unmounted) ...
}
componentWillUnmount() {
this.unmounted = true
}
- fatso83 9y agoThat's not a static car on the class. It's on the instance! A static class property would entail something like `Foo.unmounted = true` (a bad idea).