1.0.1-0 • Published 7 years ago

redux-rack v1.0.1-0

Weekly downloads
4
License
AGPL-3.0
Repository
github
Last release
7 years ago

redux-rack

Treat Redux like a rack — mount reducers like components

Use

withReducer('foo', (foo, action) => foo)(Component)

Combine

withReducer({
  foo(foo, action) {
    // … reducer logic …
  },
  bar(bar, action) {
    // … reducer logic …
  },
})

Nest

withReducer({
  bar(bar, action) {
    // … reducer logic …
  },
  // Runs after, on nested value
  'bar.baz': (baz, action) => {
    // … reducer logic …
  },
})

Iterate

withReducer({
  // Run for each list item
  'foos[]': (item, action) => {
      // … reducer logic …
  },
  // Run after, for each item property
  'foos[].ball': (property, action) => {
      // … reducer logic …
  },
})

Throw caution to the wind

withReducer((state, action) =>
  // time for something completely different
)

Status

  • withReducer signature

    • simple (key, reducer)
    • combined { foo, bar }
    • nested { bar, bar.baz }
    • iterative { foos[], foos[].prop }
    • global, window.throw(caution)
  • Development

    • stable
    • active
    • wanting
    • in need of intervention