async-actions

tiny redux action names helper

Usage no npm install needed!

<script type="module">
  import asyncActions from 'https://cdn.skypack.dev/async-actions';
</script>

README

async-actions

tiny redux action names helper

Usage

Create a FOO async action.

import asynActions from 'async-actions'

const FOO = asynActions('FOO')

Then in your reducer

function myReducer (state, action) {
  switch (action.type) {
    case FOO.FAILURE:
      // Handle errors.

    case FOO.REQUEST:
      // Start request.

    case FOO.SUCCESS:
      // Handle response.
  }
}

License

MIT