Some help little fixes ... remember "Right Resource Management"#18
Some help little fixes ... remember "Right Resource Management"#18lguzzon wants to merge 3 commits intofacebook:masterfrom
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.
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.