子页面传递该如何通讯?
import { HashRouter as Router, Route, Link } from 'react-router-dom'class Index extends Component { render() { return ( <Router basename="/index"> <div className="index-content" > <Link to="/library">library</Link> <Link to="/passbook">passbook</Link> <Link to="/login">login</Link> <br/> <Route path="/library" component={Library}/> <Route exact path="/passbook" component={Passbook}/> <Route path="/login" component={Login}/> </div> </Router> ) } } export default Index;
1.login页面(#/index/login)使用this.state.isLogin标识登陆状态,进行登陆后this.state.isLogin变为true
2.这时候我切过去passbook页面(#/index/passbook)需要login页面(#/index/login)的isLogin来进行判断该渲染什么UI组件,请问一下这里怎样才能把login页面的isLogin传过去passbook页面呢?
慕容3067478
相关分类