**// 为什么可以收到dispatch????**
export const login = (form:AuthForm)=>(dispatch:AppDispatch)=>auth.login(form).then(user=>dispatch(setUser(user)))
export const register = (form: AuthForm)=>(dispatch:AppDispatch)=>auth.register(form).then(user=>dispatch(setUser(user)))
export const logout = ()=>(dispatch:AppDispatch)=>auth.logout().then(()=>dispatch(setUser(null)))
export const bootstrap = ()=>(dispatch:AppDispatch)=>bootstrapUser().then(user=>dispatch(setUser(user)))
解锁 React17 高阶用法,轻松应对大型复杂长周期项目
了解课程