Pong420 / crud-reducer

CRUD reducer for react/redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CRUD Reducer

CRUD reducer for react/redux

Install

git clone https://github.com/Pong420/crud-reducer.git --branch=dist crud-reducer
rm -rf ./crud-reducer/.git

Examples

Utils / Types

  • GetCreatorsAction and ExtractAction
import { GetCreatorsAction, ExtractAction } from '../';

function actions4() {
  return { type: 'Action4' as const };
}

// An object contains function that return { type: string, payload? any }
// you may use enum instead of `as const`
const actions = {
  action1: () => ({ type: 'Action1' as const }),
  action2: (payload: boolean) => ({ type: 'Action2' as const, payload }),
  action3: (payload?: boolean) => ({ type: 'Action3' as const, payload }),
  actions4
};

type Actions = GetCreatorsAction<typeof actions>;

type Aaction3 = ExtractAction<Actions, 'Action3'>;

About

CRUD reducer for react/redux


Languages

Language:TypeScript 96.0%Language:JavaScript 2.9%Language:Shell 1.1%