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

How to use withLogger with namespaced state and effects?

AfflatusX opened this issue · comments

Looks like withLogger only takes single store definition?

It's a little ugly, but you can do something like:

createConnectedStoreAs(initialStates, stores => {
  return withEffects({
    a: withLogger(stores.a),
    b: withLogger(stores.b)
  })
})

createConnectedStoreAs's second argument is any function that takes an object of stores, and returns an object of stores.