browserHistory在React-router中不起作用

时间:2018-05-03 14:06:58

标签: react-router

我试图在React-router中将hashHistory更改为browserHistory,但我遇到了问题。我用browserHistory替换了hashHistory,但浏览器显示警告:

    Warning: [react-router] Location "/supmev2/index.html_ijt=3k35aa2cad6gsqau4hqdg9gvnp" did not match any routes

我的App.jsx:

class App extends React.Component{
render(){
    return (
        <Router history={browserHistory}>
            <Route path="/" component={Template}>
                <IndexRoute component={HomePage}></IndexRoute>
                <Route path="/contact" component={Contact}></Route>
            </Route>
        </Router>
    )
}
}

这是我的模板:{

class Template extends React.Component {
render() {
    return (
        <div>
                {this.props.children}
            <Footer></Footer>
        </div>
    )
}
}

0 个答案:

没有答案