• home > tools > Bundler > webpack >

    webpack4.x 升级react-router v4 发现history 冲突

    Author:[email protected] Date:


    Uncaught Error: You have provided a history object created with history v4.x or v2.x and earlier. This version of React Router is only compatible with v3 history objects. Please change to history v3.x.


    const history = createHashHistory({
      basename: '', // The base URL of the app (see below)
      hashType: 'slash', // The hash type to use (see below)
      // A function to use to confirm navigation with the user (see below)
      getUserConfirmation: (message, callback) => callback(window.confirm(message))

    整个是来自官方的demo 还是跑不通。坑爹啊

    然后,history有2.x 3.x 4.x 等几个版本,各个都不兼容。react-router 2.x 3.x 兼容,4.x 不兼容。

     npm i -D [email protected]

    转载本站文章《webpack4.x 升级react-router v4 发现history 冲突》,