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
The following code will cause a recursive render loop. Changing state2 from {} to a primitive value (such as true) OR removing the .value stops the behavior. Is this intentional? Why is using .value in dependencies like this causing a recursive re-render? In virtually all other cases, using .value in a dependency does not cause re-renders of any kind.
constChild=(props: {state: any})=>{conststate2=useHookstate({})useEffect(()=>{props.state.set({})},[state2.value])// getting rid of .value here solves the problemreturn<></>}constParent=()=>{conststate=useHookstate({})useEffect(()=>{console.log('state',state.value)},[state])return<Childstate={state}/>}
The text was updated successfully, but these errors were encountered:
The following code will cause a recursive render loop. Changing state2 from
{}
to a primitive value (such astrue
) OR removing the .value stops the behavior. Is this intentional? Why is using .value in dependencies like this causing a recursive re-render? In virtually all other cases, using .value in a dependency does not cause re-renders of any kind.The text was updated successfully, but these errors were encountered: