0.0.11 • Published 3 years ago

redux-sputnik v0.0.11

Weekly downloads
10
License
MIT
Repository
github
Last release
3 years ago

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};
    }
});
0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago