Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
travmatt
on Nov 10, 2017
|
parent
|
context
|
favorite
| on:
Simple React Patterns
Set a variable... set a property in the component state? Or set a static variable on the class?
pcmaffey
on Nov 10, 2017
[–]
I use a static var on the class.
componentDidMount() { if (!this.unmounted) ... } componentWillUnmount() { this.unmounted = true }
fatso83
on Nov 11, 2017
|
parent
[–]
That'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).
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: