Flexible Standard Action Creators

Lately I have been working with a lot of micro transactions in Redux state via froms, I'm not a huge fan of repetitive actions, so I wrote a nifty flexible standard action creator. It sounded like a great item to put up for a horrible howto!

I went ahead and decided to try something new out with my action store. I wanted to cut out at least a portion of my action files to unbloat the process.

function updateForm(typeName,payload) {
  return {
    type: typeName,
    payload: payload

export function dispatchUpdate(typeName,payload) {

Thus I present to you, a flexible action! This action allows us to remove one more level of boilerplate that we have to follow within our actions on the way to maintaining state!

All we have to do at this point is drop in our actionType and then import it into the reducer.

From your actual React Component calling this action you can now simply import it as an action(preferably with bindActionCreators, and fire it off on an onChange event or however your heart desires!

Show Comments

Get the latest posts delivered right to your inbox.