@aucsys/redux-ez
v0.1.14
Published
Ez reducers for your basic CRUD needs
Downloads
31
Readme
redux-ez
Ez reducers for your basic CRUD needs
Install
npm install --save redux-ez
Usage
- Create instance of ReduxEz
const ez = ReduxEz({ baseUrl: "https://example.com/api", makeHeaders: async () => {return {'x-header': 'value'}} })
- Use exposed methods to create slice actions with desired functionality
const { initialState: testInitialState, thunk: getTest, reducers: testReducers, stateNames: getTestStateNames } = getSliceActions({ actionName: "getTest", storeName: TEST_STORE_NAME, entityNameInStore: "test", thunkName: "/test/get", showToastOnSuccess: true, showToastOnFail: true, makePath: (payload) => { // Action payload return `/test/${payload.id}` } })
License
MIT © aucsys-com