Feature request: pair ReactDOM.unmountComponentAtNode with ReactDOM.render calls.
lijunle opened this issue · comments
If a file calls ReactDOM.render
, it could better to call ReactDOM.unmountComponentAtNode
in this same file when dispose.
I have a rule to count the calls to ReactDOM.render
and ReactDOM.unmountComponentAtNode
in the same file. If they are not the same, report an error on it.
Besides, if the returning value of ReactDOM.render
call is captured by a variable, that variable should be unset to undefined
or null
something in the file to avoid memory leak.
Is this project accepting such a rule?
This seems pretty difficult to maintain and use in practice as a general rule. We have many examples in our code bases where such a pairing within the same file wouldn't work at all. I'd recommend implementing this as a custom rule in your projects.