@36node/redux-ui
TypeScript icon, indicating that this package has built-in type declarations

0.0.31 • Public • Published

Redux ui

version downloads

Use

Config redux:

import { reduxUiReducers } from "@36node/redux-ui";

combineReducers({
  ...reduxUiReducers,
});

Assign

Save any value to redux.

actions:

import { createAssignActions } from "@36node/redux-ui/assign";

const assignActions = createToggleActions("someKey");

// set action: set value
dispath(assignActions.set(someValue));

selector:

import { createAssignSelector } from "@36node/redux-ui/assign";

// selector maker
const selector = createAssignSelector("someKey");

const assign = selector(state).assign;

Toggle

Open or close a toggle to redux.

actions:

import { createToggleActions } from "@36node/redux-ui/toggle";

const toggleActions =  createToggleActions("someKey"),

// open toggle action
dispath(toggleActions.open());

// close toggle action
dispath(toggleActions.close());

// set toggle action
dispath(toggleActions.set(true or false));

selector:

import { createToggleSelector } from "@36node/redux-ui/toggle";

// selector maker
const selector = createToggleSelector("someKey");

const toggle = selector(state).toggle;

Progress

Represent an progress logic in redux.

actions:

import { createProgressActions } from "@36node/redux-ui/progress";

const progressActions = createProgressActions("someKeys");

// increase action, default step = 1
dispatch(progressActions.increase(5));
// decrease action, default step = 1
dispatch(progressActions.decrease(5));
// init action, default params: step = 1, min = 0, max = 100
dispatch(progressActions.init(1, 0, 100));

selector:

import { createProgressSelector } from "@36node/redux-ui/progress";

const selector = createProgressSelector("someKey");

// progressState: {step, min, max}
const progressState = selector(state);

Readme

Keywords

none

Package Sidebar

Install

npm i @36node/redux-ui

Weekly Downloads

44

Version

0.0.31

License

MIT

Unpacked Size

57.5 kB

Total Files

9

Last publish

Collaborators

  • xuna08
  • zzswang
  • hauy
  • 36node-robot