@itemku/redux-maker
Easily create redux action, reducers
Last updated a month ago by riofivejack .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @itemku/redux-maker 
SYNC missed versions from official npm registry.

Redux Maker

npm version CI

Redux maker is an action creator and reducers helper that will create the actions and name for you

Quickstart

create actions + reducers return

import 'ReduxMaker' from '@itemku/redux-maker';

export const Actions = {
  testChangeId: (userId: number) => {
    let state = store.getState();
    return {
      user: {
        ...state.reducersTest.user,
        userId: userId,
      },
    };
  },

  testChangeEmailPassword: (email: string, password: string) => {
    let state = store.getState();
    return {
      user: {
        ...state.reducersTest.user,
        email: email,
        password: password,
      },
    };
  },

  testChangeEmailPasswordAlternative: (email: string, password: string) => (prevState: any) => {
    return {
      user: {
        ...prevState.reducersTest.user,
        email: email,
        password: password,
      },
    };
  },
};


export const Sagas = {
  testLoginSagas: (email: string, password: string) => ({
    email,
    password,
  }),
};

const testAction = (test: AnyAction) => {
  console.log('SAGAS RUN', test);
};

const testReducers = new ReduxMaker('TEST', INITIAL_STATE, Actions, Sagas);

export default testReducers; // for getting name info etc

export const sagas = [
  takeLatest(testReducers.names.testLoginSagas, testAction),
]; // for sagas part
export const reducers = testReducers.getReducers; // for reducers part

Current Tags

  • 0.2.3                                ...           latest (a month ago)

5 Versions

  • 0.2.3                                ...           a month ago
  • 0.2.2                                ...           2 months ago
  • 0.2.1                                ...           2 months ago
  • 0.1.1                                ...           2 months ago
  • 0.1.0                                ...           2 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 5
Last Month 20
Dependencies (1)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |