最近在学习react,想实现一个登录跳转的功能,在网络上查询了很多文档,大多都是未升级之前的版本,经过长时间的爬坑,终于实现了这个小例子,在此记录一下。
1.react-router-dom
整个前端路由的选择在index.js页面
ReactDOM.render((
<HashRouter>
<div>
<Route exact path="/" component={App}/>
<Route path="/manage" component={Manage}/>
</div>
</HashRouter>
), document.getElementById('root'));
2.APP组件就是登录表单
class App extends Component {
render() {
var innerHeight = window.innerHeight;
return (
<div>
<Layout>
<Content className="ant-layout-content-back" style={
{height: innerHeight}}>
<LoginForm>