paste related codes:
i.app.jsx
render(){
return (
<HashRouter history={hashHistory}>
<Switch>
<Route path="/" exact component={Home}></Route>
<Route path="/info" exact component={Info}></Route>
</Switch>
</HashRouter>
)
}
2.home.jsx
import Test from "@/test.jsx";
handleClick = () => {
this.props.history.push(`/test`);
};
render(){
return (
<button onClick={this.handleClick.bind(this)}></button >
<Route path=`/test` component={Test} />
)
}
3.test.jsx
render(){
return (
<div></div>
)
}
export default withRouter(Test);
problem description: when I open http://localhost:3000/-sharp/, there is no problem. When I click the button to test the sub-route, the route is http://localhost:3000/-sharp/test, but it is not rendered and does not match. What is going on? all the methods on the Internet have tried, withRouter history and so on. It can"t be solved.
but info nesting routes are relevant. Can"t there be child routes in"/"?