create-actions
A tool to create action creators
Why would you use this?
If you're working with instances of alt or if you want to use action creators then this facilitates the creation of them by keeping your code concise.
Alt supports using action creators to dispatch, this means you can import
your actions directly in a component to use them rather than inject it through using context.
Example action creator
const CountIncremented = id: 'increment' { return 1 }
You can then listen to this action in your store normally
this
and you can dispatch it using alt.dispatch
alt
Writing various actions can be tedious so this tool creates a shorthand for creating them.
Use it to create your own actions. Actions return the data they want to dispatch. Good for use with Alt
'UserActions' loggedIn: dispatch loggedOut: dispatch { request return newName }
You can also generate actions if all they are doing is passing data directly through to the store.
'MusicActions' 'genreSelected' 'songPlayed' 'songStopped' 'fetchRelatedAlbums'
Using this with something like redux
is also straightforward.
const DocumentActions = store