前言:

  • react-router-dom 4.4.2

在页面中直接使用

import { Link } from 'react-router-dom'
//使用
<Link to={{ pathname: "/app/studyMapModule/detail" }} >detail</Link>
可能报错:
browser.js?fec5: Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack

原因:这个是 reactr-router 的一个提示,当前路由下的 history 不能 push 相同的路径到 stack 里。只有开发环境存在,生产环境不存在,目前还没看到官方有去掉的意思。看不惯的话可以采取一些方法关掉这个提示。

解决:添加上replace

<Link to={{ pathname: "/app/studyMapModule/detail" }} replace>detail</Link> 

或者:

The warning is there just to let you know that when you're using hash history, you can't actually PUSH the same path; the browser won't add anything to the history stack.

But you should only get this warning in development. If you generate your production build correctly (using NODE_ENV=production) you shouldn't see this warning in production.

参考:https://github.com/ReactTraining/history/issues/488

https://segmentfault.com/q/1010000012463788

react 记录:React Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack的更多相关文章

  1. Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack

    现象 在用`mobx-react-router`的`this.props.history.push("/")`的时候,浏览器会提示 Warning: Hash history ca ...

  2. Hash history cannot PUSH the same path; a new entry will not be added to the history stack

    这个是reactr-router的一个提示,当前路由下的history不能push相同的路径.只有开发环境存在,生产环境不存在,目前还没看到官方有去掉的意思.看不惯的话可以采取一些方法关掉这个提示.具 ...

  3. React 记录(1)

    作为一个前端工程师,前端框架是必须会的,所以开始学习React. 学习的方法是:先实践,后图文记录. React官网:https://reactjs.org React中文网站:https://www ...

  4. 解决React路由URL中hash(#)部分的显示 、browserHistory打包后浏览器刷新页面出现404的问题

    摘要 在React项目中,我们需要采用它的路由库React-Router来进行页面跳转,React会根据路由URL来判断是哪个页面.常见的的URL有两种显示方式,一种是hashHistory的形式,形 ...

  5. React & Special Props Warning

    React & Special Props Warning key & ref demo index.js:1 Warning: Comment: key is not a prop. ...

  6. react第十四单元(react路由-react路由的跳转以及路由信息)

    第十四单元(react路由-react路由的跳转以及路由信息) #课程目标 理解前端单页面应用与多页面应用的优缺点 理解react路由是前端单页面应用的核心 会使用react路由配置前端单页面应用框架 ...

  7. JavaScript 和 React,React用了大量语法糖,让JS编写更方便。

    https://reactjs.org/docs/higher-order-components.htmlhttps://codepen.io/gaearon/pen/WooRWa?editors=0 ...

  8. react第十三单元(react路由-react路由的跳转以及路由信息) #课程目标

    第十三单元(react路由-react路由的跳转以及路由信息) #课程目标 熟悉掌握路由的配置 熟悉掌握跳转路由的方式 熟悉掌握路由跳转传参的方式 可以根据对其的理解封装一个类似Vue的router- ...

  9. react实战 : react 与 canvas

    有一个需求是这样的. 一个组件里若干个区块.区块数量不定. 区块里面是一个正六边形组件,而这个用 SVG 和 canvas 都可以.我选择 canvas. 所以就变成了在 react 中使用 canv ...

随机推荐

  1. 集成运放输入电压范围指标参数Uicmax,Uidmax

    图中Uicmax最大共模输入电压:是运放能正常工作下的最大输入电压: Uidmax最大差模输入电压:是运放要损坏的最大输入电压

  2. lambda, 匿名函数, 变量,传参

    lambda: # 无参数函数情况 def delete_one(): pass Button(otherFrame, text="删除", width=4, command=de ...

  3. 汇编实验15:安装新的int 9中断例程

    汇编实验15:安装新的int 9中断例程 任务 安装一个新的int 9中断例程,功能:在DOS下,按下“A”键后,除非不在松开,一旦松开后,就显示满屏幕的“A”,其他键照常处理. 预备知识概要 这次实 ...

  4. Django-modelfrom组件

    ModelForm     a.  class Meta:             model,                           # 对应Model的             fi ...

  5. SharePoint2013修复报错

         今天项目组的Sharepoint2013不小心被卸载了,本想着直接修复,谁知道在修复的时候一直报错,说找不到什么文件.报的就是类似于这样的错误: Product: ######### -- ...

  6. What to do when Enterprise Manager is not able to connect to the database instance (ORA-28001)

    摘自:http://dbtricks.com/?p=34 If you are trying to connect to the Oracle enterprise Manger and you ge ...

  7. 小旭讲解 LeetCode 53. Maximum Subarray 动态规划 分治策略

    原题 Given an integer array nums, find the contiguous subarray (containing at least one number) which ...

  8. Hibernate 查询,返回结果设置到DTO

    1:原生sql的查询,返回结果设置到DTO: Query query = sessionFactoryRtData.getCurrentSession().createSQLQuery(hql.toS ...

  9. BZOJ 2049 SDOI2008 洞穴勘测 LCT板子

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2049 题意概述:给出N个点,一开始不连通,M次操作,删边加边,保证图是一个森林,询问两点连 ...

  10. mysql原理以及相关优化

    说起MySQL的查询优化,相信大家积累一堆技巧:不能使用SELECT *.不使用NULL字段.合理创建索引.为字段选择合适的数据类型..... 你是否真的理解这些优化技巧?是否理解其背后的工作原理?在 ...