//引入 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 <登陆页 />; } }