This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
Suggest rule: pair-react-dom-render-unmount #751
Labels
External
Issues that should be addressed in other repositories.
Status: In Discussion
Please continue discussing the proposed change before sending a pull request.
Milestone
Rule Suggestion
Is your rule for a general problem or is it specific to your development style?
Yes
What does your suggested rule do?
The team did some investigation on performance and found there is memory leak because:
ReactDOM.render
withoutReactDOM.unmountComponentAtNode
to unmount it.ReactDOM.render
without set it back toundefined
when disposed.The idea of the rule is to do two things:
ReactDOM.render
must equal to the number of calls toReactDOM.unmountComponentAtNode
. Technically, they don't need to be in the same file, but it is easier to maintain/review if they appear as a pair.ReactDOM.render
method call, that variable must be set toundefined
ornull
something in the same file.List several examples where your rule could be used
SharePoint web parts.
The text was updated successfully, but these errors were encountered: