-
Notifications
You must be signed in to change notification settings - Fork 49.9k
Some help little fixes ... remember "Right Resource Management" #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think that "resource management" is important; so once You instantiate a resource in a Component then You have to dispose it at the Component life-time's end (in this case using "componentUnMount" method). That's it.
|
Also, please don't remove the brackets on the code fences. This is what allows us to do line highlighting and call out specific changes in the tutorial. |
|
On GitHub it won't be - we customized markdown processing a little bit to enable it on the website. That customization actually breaks the highlighting on Github since it's a custom extension. See it in action: http://facebook.github.io/react/docs/tutorial.html |
docs/docs/tutorial.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React's lifecycle will guarantee that componentWillMount() is called before componentWillUnmount(), so you don't need to do this check :D See http://facebook.github.io/react/docs/advanced-components.html
|
@jordow I have a mixin that does this for IG that I want to get into react_contrib. This is probably a good idea for us to do, however if we use React.autoBind() on the function passed to setInterval() it'll suppress the errors when the component unmounts. I'm pretty sure that killing the setInterval() is better though. I'm inclined to take this (once rebased) if everyone's OK with it. |
|
We've redone a lot of the docs (and a lot of React) since this was opened so I'm going to just close it out. |
fix link in community roundup #18
(cherry picked from commit a8e273f)
…cebook#18) * add cross-env to set NODE_ENV on windows and fix build on windows * Update package-lock.json * Update api.server.js * Update package.json Co-authored-by: Ahsan Sohail (213979) <AhSohail@KHI-ICX-AHSANS> Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
I think that "resource management" is important; so once You instantiate a resource in a Component then You have to dispose it at the Component life-time's end (in this case using "componentWillUnmount" method).
That's it.