TypeError:无法读取未定义的属性'originalUrl';使用Next.JS和React-Router-DOM

我正在使用此guide将Next.js拥有的路由系统转换为我的应用程序中的React-Router-DOM风格。

当我使用浏览器的前进或后退按钮时,出现此错误。

这是我的错误:

TypeError:无法读取未定义的属性'originalUrl';使用Next.JS和React-Router-DOM

看来它指向我为react-router提供的样板 AND 我正在与with-redux-thunk集成的库

我是否假设存在冲突?

如果是这样的话...

我的_app文件对我来说还好吗?

import React from 'react'
import App,{ Container } from 'next/app';

import withReduxStore from '../lib/with-redux-store'
import { Provider } from 'react-redux'
import { persistStore } from 'redux-persist'
import { PersistGate } from 'redux-persist/integration/react'


import withReactRouter from '../with-next-router/with-next-router'


class MyApp extends App {
 constructor(props) {
  super(props)
  this.persistor = persistStore(props.reduxStore)
 }

 render() {
  const { Component,pageProps,reduxStore } = this.props
  return (
   <Provider store={reduxStore}>
    <PersistGate
     loading={<Component {...pageProps} />}
     persistor={this.persistor}
    >
    <Container>
      <Component {...pageProps} />
    </Container>
    </PersistGate>
   </Provider>
  )
 }
}

export default withReduxStore(withReactRouter(MyApp))

非常感谢您的帮助!

longsheng923123 回答:TypeError:无法读取未定义的属性'originalUrl';使用Next.JS和React-Router-DOM

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3106387.html

大家都在问