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
useEffect(()=>{setValue(value+' appends');},[value])// can improveuseEffect(()=>{setChecked(checked+' appends')},[checked])
Bad
useEffect(()=>{// possible unnecessary state update if value not changedsetValue(value+' appends');// possible unnecessary state update if checked not changedsetChecked(checked+' appends');},[value,checked])
My actual use case would be too complicated to show here.
The text was updated successfully, but these errors were encountered:
Hi, thanks for your suggestion. RFCs should be submitted as pull requests, not issues. I will close this issue but feel free to resubmit in the PR format.
I would like to request adding the indices of updated dependencies of
useEffect
,useLayoutEffect
as arg of the callback.For example:
if
dep1
anddep3
changes, then indices of the dependencies that triggers the update should be passed to the callback as argument.I think this feature will be useful for most of us all.
This is just one example use case
Allow component modify prop internally
Good
Can improve
Bad
My actual use case would be too complicated to show here.
The text was updated successfully, but these errors were encountered: