我想使用history
库,但收到以下消息:
https://www.npmjs.com/package/history
TypeError: (0 , _history.createBrowserHistory) is not a function
[0] at Object.<anonymous> (/Users/sm_emamian/Desktop/react js/shadyab/app/helpers/history.helper.js:3:30)
我的助手:
import { createBrowserHistory } from 'history';
export const historyHelper = createBrowserHistory();
package.json
:"history": "^1.17.0",
最佳答案
1.17.0版本具有createHistory而不是createBrowserHistory
检查链接-https://www.npmjs.com/package/history/v/1.17.0
// using an ES6 transpiler, like babel
import { createHistory } from 'history'
// not using an ES6 transpiler
var createHistory = require('history').createHistory