Skip to content

0.2.0

Compare
Choose a tag to compare
@pauldijou pauldijou released this 29 Sep 22:14
· 109 commits to master since this release

Metadata

You can now have some metadata. It's just as the payload, you need a function to reduce the arguments as a metadata object and it will be the third argument inside the reducer.

const doStuff = createAction('do some stuff', arg => arg, (one, two)=> {so: 'meta'});
const reducer = createReducer({
  [doStuff]: (state, payload, meta)=> payload
});

Serializable actions

Sometimes, you need to share actions between client and server, or between clients. You can no longer rely on id generated at runtime, you need to use strict manually provided constants. That's not the main goal of the lib, but if you really need it, just use a fully uppercase description and it will be use as the id.

const serializedDoStuff = createAction('DO_STUFF', arg => arg, (one, two)=> {so: 'meta'});