I want to fire action from a reducer. The action will set/unset the loader state.
Here is an example of my reducer
const ABC = reducerWithInitialState(initialState)
.case(getABCAction.started, (state) => {
const dispatch = useDispatch();
dispatch(setAppLoader(true))
return (state);
});
However, it says that its an invalid hook call.
Is there any workaround for this?
Rohan,你在reducer里面,你可以完全控制返回任何你想要的状态,你不必再分派任何动作,你可以对状态“做”你想做的任何事情。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.