You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When your render() method passes an anonymous function as a prop, a new function instance will be created and that prop's value will be different every time render() is called, which means that React will assume it needs to refresh the tree, even if nothing has "actually" changed. This can result in unnecessary DOM manipulation.
Wherever possible, we should have the function be a member of the component's class and bind it to this in the constructor, and just pass that function reference.
When your
render()
method passes an anonymous function as a prop, a new function instance will be created and that prop's value will be different every timerender()
is called, which means that React will assume it needs to refresh the tree, even if nothing has "actually" changed. This can result in unnecessary DOM manipulation.Wherever possible, we should have the function be a member of the component's class and bind it to
this
in the constructor, and just pass that function reference.e.g.
Before:
After:
The text was updated successfully, but these errors were encountered: