Inject state and dispatcher context by React.Context and useContext import React, { useReducer, useContext, Dispatch, ReactElement } from "react"; import ReactDOM from "react-dom"; type CounterState = { count: number; }; const initialState: CounterState = { count: 0 }; function reducer(state: CounterState, action: any) { switch (action.type) { case "reset": { return initialState; } case "increment
![Minimum flux with useReducer - DEV Community 👩💻👨💻](https://cdn-ak-scissors.b.st-hatena.com/image/square/d17e03900bb61b4841a4f1e8e793eaaad83db7f1/height=288;version=1;width=512/https%3A%2F%2Fdev.to%2Fsocial_previews%2Farticle%2F65261.png)