oz-redux-dispatcher
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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 😉

Package Sidebar

Install

npm i oz-redux-dispatcher

Weekly Downloads

1

Version

1.0.0

License

none

Unpacked Size

4.99 kB

Total Files

9

Last publish

Collaborators

  • ofir-zeitoun