bcherny / undux

⚡️ Dead simple state for React. Now with Hooks support.

Home Page:https://undux.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

using multiple stores

sirpy opened this issue · comments

commented

The current suggestion to use nested stores doesn't allow same component to use two different stores.
The suggestion to use namespacing removes the separation of concerns possibility and will cause rerender in components needing only one store.

Using two stores seems to be working use react hooks ie useStore, but withStore doesn't seem to support composing. Any solution for that?

Hey there! You have a few options:

  1. Use useStore (preferred)
  2. Use createConnectedStoreAs. See https://undux.org/#examples/namespaced-state