this.isMounted()
is a deprecated feature and was removed in React 16.
At best we can semantically remove all usages of isMounted() throughout the codebase.
At worst, we can at least simulate having an isMounted() function by creating our own variable for it that gets set in componentWillMount()
and componentWillUnmount()
edit from oct 20th: this actually isn't necessary for the React 16 upgrade because createReactClass
still supports it
Thankfully, not too much usage for us:
โฏ ag --count isMounted
reader/tag-stream/main.jsx:5
blocks/daily-post-button/index.jsx:4
my-sites/draft/index.jsx:2
my-sites/checkout/cart/popover-cart.jsx:1
components/tinymce/plugins/simple-payments/dialog/index.jsx:6
components/olark-chatbox/index.jsx:1
components/domains/register-domain-step/index.jsx:4
components/stat-update-indicator/index.jsx:1
components/infinite-list/index.jsx:3
components/token-field/token-input.jsx:2
me/two-step/index.jsx:1
post-editor/media-modal/gallery/preview-shortcode.jsx:1
lib/accept/dialog.jsx:1
Also need to check our deps in node_modules
... but hopefully they'll declare compat with react@16
?
Did a quick check on what I found using isMounted
and made up a check list. The stuff left needs to be fixed.
Relevant React docs: https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
After further research, it looks like isMounted()
is still supported when using createReactClass. While it will be good to fix them all, I'd consider it to be part of the "Backburner" category now and shouldn't be seen as necessary on the road to 16
only cases left are:
I'm closing this Issue though because there is no pressing need to fix them
Most helpful comment