@abdulghani/combinereducer 中文文档教程
combineReducers function
这是一个用于 reducer 的轻量级 combineReducers 函数。 适用于 redux
或 useReducer
。
installation
纱线
yarn add @abdulghani/combinereducer
npm
npm install @abdulghani/combinereducer
usage
import combineReducer from "@abdulghani/combinereducer";
import { reducerOne, reducerTwo } from "somewhere";
const combinedReducers = combineReducer({
page: reducerOne,
data: reducerTwo
});
const MyApp = () => {
const [state, dispatch] = useReducer(combinedReducers);
// render
};
combineReducers function
this is a lightweight combineReducers function for reducers. works with either redux
or useReducer
.
installation
yarn
yarn add @abdulghani/combinereducer
npm
npm install @abdulghani/combinereducer
usage
import combineReducer from "@abdulghani/combinereducer";
import { reducerOne, reducerTwo } from "somewhere";
const combinedReducers = combineReducer({
page: reducerOne,
data: reducerTwo
});
const MyApp = () => {
const [state, dispatch] = useReducer(combinedReducers);
// render
};