webcored/react-local-storage

Redux state support

Opened this issue · 0 comments

Currently, this hook uses the useState hook for state management. When a state of key is updated, it's not reflected in other states of the same key.

cost [user, userDispatch] = useLocalStorage('user')
cost [user2, user2Dispatch] = useLocalStorage('user')

userDispatch.reset(); // updates the user, not user2

To resolve this we can use redux instance if a project is using redux for their state management.