Skip to content

2.4.0

Compare
Choose a tag to compare
@developit developit released this 08 Dec 17:26
· 156 commits to master since this release

🐞 Bug Fixes

🔧 Tweaks

🎉 New Features

  • store.subscribe() now returns an unsubscribe function! (#22, thanks @cristianbote)
  • New store.action(action) API for creating store-bound actions (like connect() does):
let store = createStore()
store.subscribe(console.log)  // log all store updates

// We start with a pure function, as you might pass to connect():
let increment = ({ count }) => ({ count: count + 1 });

// Passing that to createAction() returns a handler like you would get from connect():
let incrementAction = store.createAction(increment)

// Calling the action applies it to the store:
incrementAction()   // logs { count: 1 }