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
import{useLocalStorage}from'react-use';constDemo=()=>{const[value,setValue]=useLocalStorage('my-key','foo');return(<div><div>Value: {value}</div><buttononClick={()=>setValue(prev=>{// prev value is always the samereturn'bar')}>bar</button></div>);};
What is the expected behavior?
the same behavior as in useState React hook
A little about versions:
React: 18.2.0
react-use: 17.5.0
aaronmaxcarver, SerVB, pmeinhardt, wsoaresfilho, MerlinMason and 2 moreahoseinian, amaury-hanser, v-ll-v and Muhammed-Rahif