首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解析“历史/创建浏览历史”

无法解析“历史/创建浏览历史”
EN

Stack Overflow用户
提问于 2021-02-25 11:45:39
回答 1查看 1.4K关注 0票数 0

我在redux商店里使用历史有问题。

,这是我的store.js

代码语言:javascript
复制
 import { applyMiddleware, createStore } from 'redux';
// import { createLogger } from 'redux-logger'
import { composeWithDevTools } from 'redux-devtools-extension/developmentOnly';
import reducer from './reducer'; //Import our reducer
import thunk from 'redux-thunk'
import createHistory from 'history/createBrowserHistory';
export const history = createHistory();
// Build the middleware for intercepting and dispatching navigation actions
const myRouterMiddleware = routerMiddleware(history);
//Create our Store using createStore and the reducer as an argument.
export const store = createStore(
  reducer, composeWithDevTools(applyMiddleware(thunk)));

我所犯的错误是:

编译失败。

./src/redux/store.js模块未找到:无法解析'/home/salathiel/Documents/realcamuniv/src/redux'中的“历史/创建浏览历史”

EN

回答 1

Stack Overflow用户

发布于 2021-02-25 11:57:53

你试图访问历史的方式是不可取的,这是一个警告

Warning: Please use require("history").createBrowserHistory instead of require("history/createBrowserHistory"). Support for the latter will be removed in the next major release

试试这条路

代码语言:javascript
复制
import { createBrowserHistory } from 'history'
export const history = createBrowserHistory(); 
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66367844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档