redux-sputnik
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

redux-sputnik

Utils for redux

Installation

npm install redux-sputnik

newAction

Creates an action

import { newAction } from 'redux-sputnik';

export const CommonActions = {
    myAction: (param: string) => newAction(CommonActionTypes.MY_ACTION, param),
}

newActionType

Creates action type identifier

import { newActionType } from 'redux-sputnik';

const prefix = 'common';

export const CommonTypes = {
    MY_ACTION: newActionType(prefix, 'MY_ACTION')
}

newReducer

Creates reducer

import { newReducersetState } from 'redux-sputnik';

const COMMON_INITIAL_STATE = {};

export const commonReducer = newReducer(AUTH_INITIAL_STATE, {
    [CommonTypes.MY_ACTION]: (state, params: string) => {
        return setState(state, _ => _.value, params};
    }
});

setState

Changes redux state

import { newReducer, setState } from 'redux-sputnik';

const COMMON_INITIAL_STATE = {};

export const commonReducer = newReducer(AUTH_INITIAL_STATE, {
    [CommonTypes.MY_ACTION]: (state, params: string) => {
        return setState(state, _ => _.value, params};
    }
});

Package Sidebar

Install

npm i redux-sputnik

Weekly Downloads

24

Version

0.0.11

License

MIT

Unpacked Size

13.6 kB

Total Files

21

Last publish

Collaborators

  • vimbat