score:0

class Admin extends React.Component {
  state = {
    access: null,
  };
  componentDidMount() {
    this.unListen = firebase.auth().onAuthStateChanged(user => {
      if (user) {
        this.setState(() => ({ access: true }));

      }
    });
  }

  componentWillUnmount() {
    this.unListen();
  }

  render(){
    const { access } = this.state;
    if(access !== null) {
         return null;
    }
    return <Tab access={this.state.access}/>
  }
}

score:1

return this.state.access 
    ? <Tab access={this.state.access}/> 
    : <div>Not authorized</div>

score:1

{access ? <Tab access={access}/> : 'Not Authorized'}

Related Query

More Query from same tag