1.0.0 • Published 7 months ago

oz-redux-dispatcher v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

oz-redux-dispatcher

This utility get all actions into useDispatch hook.

Uses oz-redux-reducer

Works with:

  1. Redux
  2. Redux Thunk
  3. React Redux

Example:

Live demo - TBD

Install:

First follow instruction of oz-redux-reducer

npm i oz-redux-dispatcher

Usage:

in store/actions/index.ts file:

import { useDispatchActions } from "oz-redux-dispatcher";

import { demoActions } from "../reducers/demo-reducer";

export const useDemoActions = () => useDispatchActions(demoActions);

calling actions:

import { useDemoActions } from "../store";

export default function ShowText({ text = "" }: { text?: string }) {
  const { dispatchSetText } = useDemoActions();

  return <button onClick={() => dispatchSetText(text)}>Set text</button>;
}

Now replace old reducers with new ozReducer & ozDispatcher 😉

1.0.0

7 months ago

0.0.2

8 months ago

0.0.1

8 months ago