我是React研究的新手。 通过单击链接,该链接将显示在地址栏中,但是该组件仅在刷新页面后才适用
index.js /
ReactDOM.render(
<Provider store={store}>
<MuiThemeProvider muiTheme={getMuiTheme()}>
<Router>
<App/>
</Router>
</MuiThemeProvider>
</Provider>,
document.getElementById('root')
);
App.js /
class App extends Component {
render () {
return (
<div>
<h4>Navigation</h4>
<ul>
<li>
<Link to="/home">Home</Link>
</li>
<li>
<Link to="/register">Registration</Link>
</li>
</ul>
<Router>
<Switch>
<Route exact path="/" component={HomeContainer} />
<Route path="/register" component={Registration} />
<Redirect from="*" to="/" />
</Switch>
</Router>
</div>
)
}
}
在此先感谢您的帮助