-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
A state listener like this
doSomething((myElement, [myState, setMyState]) => {
const mouseOverHandler = e => {
setMyState(/* some always changing value */)
}
myElement.addEventListener('mouseover', mouseOverHandler)
return () => {
myElement.removeEventListener('mouseover', mouseOverHandler)
}
}, [myElement, myState])is constantly being re-called, even though it does not have to be. Requiring the state in the statesAndRefs array (to use the setState function) does not imply the usage of the state's value.
Providing the option to use a setState without listening to state changes will drastically improve performance.
Metadata
Metadata
Assignees
Labels
No labels