📅  最后修改于: 2022-03-11 15:02:37.340000             🧑  作者: Mango
export const AuthContext = createContext(INITIAL_STATE);
export const AuthContextProvider = ({ children }) => {
const [state, dispatch] = useReducer(authReducer, INITIAL_STATE);
useEffect(() => {
localStorage.setItem("user", JSON.stringify(state.user));
}, [state]);
return (
{children}
);
};
export default AuthContext;