3 ms·
Set a variable... set a property in the component state? Or set a static variable on the class?
by travmatt 9y ago
Set a variable... set a property in the component state? Or set a static variable on the class?
- pcmaffey 9y agoI 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).