blog-front
blog-front copied to clipboard
新手求助~请问怎么在页面getInitialProps获取更新后的reduxStore喃?谢谢~
我在_app中修改了state的值,用redux浏览器工具查看,值是修改了的,但是在页面getInitialProps中获取到的reduxStore是初始化的值: static async getInitialProps({req,query,query:{id,param},reduxStore}){ console.log(reduxStore.getState()) }
我在_app中修改了state的值,用redux浏览器工具查看,值是修改了的,但是在页面getInitialProps中获取到的reduxStore是初始化的值: static async getInitialProps({req,query,query:{id,param},reduxStore}){ console.log(reduxStore.getState()) }
当页面初次加载时,getInitialProps只会在服务端执行一次; getInitialProps只有在路由切换的时候(如Link组件跳转),客户端的才会被执行。