//引入 Loading页面 主页面 登录页等页面组件
constructor(props) {
    super(props);
    this.state = { 登录状态: 等待检查 };
}
componentDidMount() {
    this.检查登录();    // 比如调用asyncstorage
}
检查登录() {
    if(经过检查后是已登录状态) {
          this.setState({ 登录状态: 已登录 });
    }
    else {
          this.setState({ 登录状态: 未登录 });
    }
}
render() {
const { 登录状态 } = this.state;
switch(登录状态) {
     case 等待检查:
               return <Loading页面 />;
     case 已登录:
               return <主页面 />;
     case 未登录:
               return <登录页 />;
}
}

相关文章:

  • 2022-12-23
  • 2020-05-27
  • 2022-12-23
  • 2021-12-28
  • 2021-11-25
  • 2021-07-31
  • 2022-12-23
猜你喜欢
  • 2021-07-06
  • 1970-01-01
  • 2021-09-08
  • 2021-05-19
  • 2022-02-12
  • 2022-12-23
相关资源
相似解决方案