react-router4使用HashRouter情况下,路由变化了,但是不跳转,附带错误,是这么情况呢?

0 0 react-router4 react.js react-router
error(*)
error(*)

声望值:177 0人

2019-01-25 17:09:10 提问

关注 0关注

收藏 0收藏, 77浏览

第一个报错:Warning: ignores the history prop. To use a custom history, use import { Router } instead of import { HashRouter as Router } 第二个报错:Warning: Hash history cannot PUSH the same path; a new entry will not be added to the history stack 代码如下

import React, { Component } from 'react';
import { HashRouter as Router, Route, Link, Switch, HashHistory } from 'react-router-dom';
import PropTypes from 'prop-types';
import './app.css'
import Goods from './pages/goods/goods'
import Active from './pages/active/active'
import Detail from './pages/detail/detail'
import Home from './pages/home/home'
import createHistory from 'history/createHashHistory'
const history = createHistory()


class App extends Component {
  constructor () {
    super()
    this.state = {
    }
  }
  
  render() {
    return (
      
  • 首页
  • 商品专区
  • 商品详情
  • 活动
解码器1.0
logo.png')}

) }

}

export default App;

感激不尽~搞了好久额,网上也没有具体的案例,有的也很模糊~~

请先 登录 后评论

1个回答

注册新账号

悬赏追问
10
  • 10
  • 20
  • 50
  • 100
  • 200
  • 输入数值
发布追问