home > tools > Bundler > webpack >

webpack4.x 升級react-router v4 發現history 沖突

author:[email protected]    hits:


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 沖突》, 請注明出處:http://www.qsexmk.tw/html/tools/Bundler/webpack/2016_0217_6209.html