useReducer 将 state 转换集中在单个 pure reducer 函数 中,而不是散布许多 useState setter。它是 React 内置的 Redux 模式版本。
jsx
() {
(action.) {
: { : state. + };
: { ...state, : action. };
: { : , : };
: state;
}
}
() {
[state, dispatch] = (reducer, { : , : });
;
}
