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
With React's useState hook, you can call setState multiple times and it will queue the updates, as long as you are passing a function to setState. However, in this library only the last call will take effect while all other calls will be effectively ignored.
When hooks run for the first time, setting the value in localStorage will indeed set it, but will return the previous value to the other views, so the other views will never get the latest value which was just set.
With React's useState hook, you can call setState multiple times and it will queue the updates, as long as you are passing a function to setState. However, in this library only the last call will take effect while all other calls will be effectively ignored.
Fortunately this is implemented properly in https://github.com/astoilkov/use-local-storage-state so you can use that library instead if you are running into this issue.
The text was updated successfully, but these errors were encountered: