Deprecate `isMounted`
See original GitHub issueisMounted
is already unavailable on ES6 classes, and we already have a warning saying we “might” remove them, but we don’t actually have a github issue to deprecate them. As per our discussions today, we are basically agreed that we’re going to start moving away from isMounted
and deprecate it. We still need to figure out some good stories around promises (and related use cases).
This issue is to track progress toward that goal.
For background, please read:
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:50 (18 by maintainers)
Top Results From Across the Web
isMounted is an Antipattern – React Blog
As we move closer to officially deprecating isMounted, it's worth understanding why the function is an antipattern, and how to write code ...
Read more >FixedDataTable: isMounted is deprecated - Stack Overflow
What I've understood is that isMounted is seen as an antipattern Link so im suprised to see it in the actual source code....
Read more >Creating an isMounted hook with useEffect (ReactJS)
Although isMounted is deprecated in ReactJS, maybe you need it to prevent memory leak errors in your application. Learn why there are better ......
Read more >Writing a React hook to cancel promises when a component ...
Thus isMounted() is being deprecated. They recommend you write cancelable promise. A recipe is provided in the same page based on this. It...
Read more >Should You Stop Using isMounted in React? | by Bikash Paneru
If we were to remove the if (this.isMounted) return; guard clause, we would get a warning from React if the component was not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
This simple method can be used to add cancel to any promise
EDIT: Updated for correctness/completeness.
HOW TO USE
Listing ways to sup-up ES6 promises to make them cancellable is besides the point. The intent should be to provide a solution that works WITH the spec rather than trying to work AROUND the spec.