I already answered this in a reply to another comment.
"I follow a general rule of using refs if I don't want to re-render, and using state if I want to re-render. I use local variables only for the derived state(incoming props). Also it was giving me a linting error as local variables value is lost on every re-render(which is fine in this case)."
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I already answered this in a reply to another comment.
"I follow a general rule of using refs if I don't want to re-render, and using state if I want to re-render. I use local variables only for the derived state(incoming props). Also it was giving me a linting error as local variables value is lost on every re-render(which is fine in this case)."