Open daodao90 opened 2 years ago
参照这个文档的步骤,在项目里面添加了状态管理用户相关信息 https://rax.js.org/docs/guide/miniapp-store Home页面 export default function Home() { const [userState, userDispatchers] = store.useModel('user'); useEffect(() => { //这里异步获取用户信息并使用userDispatchers.update({userInfo}) 保管用户信息 } } 页面上按钮点击时通过history.push('/otherPage')跳转到其他页面, 在这个otherPage上点击返回按钮返回到Home页面,使用userState时得到undefined? 为什么会这个样子,期望帮忙解答一下这个问题
参照这个文档的步骤,在项目里面添加了状态管理用户相关信息 https://rax.js.org/docs/guide/miniapp-store Home页面 export default function Home() { const [userState, userDispatchers] = store.useModel('user'); useEffect(() => { //这里异步获取用户信息并使用userDispatchers.update({userInfo}) 保管用户信息 } } 页面上按钮点击时通过history.push('/otherPage')跳转到其他页面, 在这个otherPage上点击返回按钮返回到Home页面,使用userState时得到undefined? 为什么会这个样子,期望帮忙解答一下这个问题