【发布时间】:2021-12-26 15:13:14
【问题描述】:
在终端看到很多行,真的需要创建这么多存储吗?
4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:39.619 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:39.667 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:39.673 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:39.780 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:40.044 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:40.061 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:40.145 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
14:47:40.329 4. WrappedApp created new store with withRedux(MyApp) { initialState: undefined, initialStateFromGSPorGSSR: undefined }
这样的线还有几百条。
【问题讨论】:
-
很难说没有看到任何会导致这种情况的代码。
-
不,这很不寻常。您可能错误地使用了 Next.js 包装器,但是如果没有代码,就很难判断错误在哪里。
-
如果您使用
getServerSideProps,客户端会在每次路由更改时向服务器请求页面道具,这样会增加日志显示的次数。
标签: javascript reactjs redux next.js