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
Currently, when we want to update the state with the useHistoryState hook, we are unable to use the same pattern useState provides, where the previous state is passed into the set function, like this:
constupdateFoo=useCallback((newFoo: string)=>{// oldValue is not available at this pointset(oldValue=>({
... oldValue,foo: newFoo});},[set])
Only the updateBar change is reflected, since we don't have the updateFoo change yet in this callback. Can we ensure we also expose the previousValue in the set handler as well?
The text was updated successfully, but these errors were encountered:
Currently, when we want to update the state with the
useHistoryState
hook, we are unable to use the same patternuseState
provides, where the previous state is passed into theset
function, like this:This means we have to do this:
However, if we now have two functions to update the state, i.e.: we also have a
updateBar
which are called in the sameonChange
handler, like such:Only the
updateBar
change is reflected, since we don't have the updateFoo change yet in this callback. Can we ensure we also expose thepreviousValue
in theset
handler as well?The text was updated successfully, but these errors were encountered: