1.0.16 • Published 4 years ago

@abdulghani/reducercontext v1.0.16

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

React Reducer Context

use reducer to provide & maintain state inside context

Installation

npm npm install @abdulghani/reducercontext\ yarn yarn add @abdulghani/reducercontext

Usage

Provide the reducer

import ReducerContext from "@abdulghani/reducercontext";
import reducer from "somewhere"
import ChildrenComponent from "somewhere"

const ParentComponent = () => {
  return (
    <ReducerContext reducer={reducer}>
      <ChildrenComponent/>
    </ReducerContext>
  )
}

Access the state & dispatch

import {useSelector, useDispatch, useThunk} from "@abdulghani/reducercontext";

const ChildrenComponent = () => {
  const state = useSelector(state => state);
  const dispatch = useDispatch();
  const thunk = useThunk();

  // use them
}
1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago