Shared global state for the same key in useLocalStorage #1192
peterbe
started this conversation in
Feature requests
Replies: 1 comment
-
Great idea, thanks for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Here's an implementation based on https://usehooks-ts.com/react-hook/use-local-storage
https://codesandbox.io/s/usehooks-ts-react-component-template-forked-2grb9l?file=/src/App.tsx
Notice how when you use the setter function, it triggers the hook to update in the getter component.
Equivalent with Mantine:
https://codesandbox.io/s/usehooks-ts-react-component-template-forked-8g0fpo?file=/src/App.tsx
the
clicks
variable in the getter component doesn't update :(PS. I love the API of the Mantine
useLocalStorage
!Beta Was this translation helpful? Give feedback.
All reactions