Skip to content

alexey-pelykh/redux-trivial-actions

 
 

Repository files navigation

redux-trivial-actions utility library by Brainbean Apps

Build Status Coverage Status npm version Dependency Status Maintainability JavaScript Style Guide MIT license

NPM

Objectified Flux Standard Action for Redux.

Getting Started

Installation

$ npm install --save redux-trivial-actions

or

$ yarn add redux-trivial-actions

Usage

actions.js

import { createTrivialAction } from 'redux-trivial-actions'

export const demoAction = createTrivialAction('DEMO_ACTION')

reducer.js

import { demoAction } from './actions'

const initialState = { demoValue: false }

const reducer = (state = initialState, action) => {
  switch (action.type) {
    case demoAction.PERFORM:
      return { ...state, demoValue: true }
    default:
      return state
  }
}

export default reducer;

component.js

import { demoAction } from './actions'

// ...
dispatch(demoAction.perform())
// or
dispatch(demoAction())
// ...

About

Objectified Flux Standard Action for Redux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%