@gaearon gaearon released this Jun 4, 2015 · 2690 commits to master since this release

Assets 2
  • Breaking change: stores now accepts an object, just like actions
  • Breaking change: Container children function signature is now ({ actions, state }) => ...
  • More fine-grained Container props validation

This fixes #22. There is no more prop shape difference between subscribing to a single or to many stores.
Your container may now look like this:

<Container stores={{ counter: stores.counterStore }}
           actions={{ increment, decrement }}>
  {({ state, actions }) => <Counter {...state} {...actions} />}

Note that you can change the state shape by giving arbitrary keys to your stores. It's also easier to choose what exactly you want to pass to the component. For example, you could write actions={actions} instead of {...actions}, and get all actions in this.props.actions.

The decorator version is changed the same way:

  actions: { increment, decrement },
  stores: { counter: counterStore }
export default class Counter {

It also now accepts a second transformProps argument to be just as expressive as the component version:

  actions: { increment, decrement },
  stores: { counter: counterStore }
}, ({ actions, state}) => { ...actions, ...state })) // default shape; you can write your own