I need to hide a component in volto if the user is logged in

Hi there,

In my footer, I added a link to log in I need to hide that if the user is logged in

        <FooterLink href="/login">
          Login In

Any help :slightly_smiling_face:

1 Like

Look at how it is done in Volto's Header component: volto/Header.jsx at master ยท plone/volto ยท GitHub

The component is connected to the user's token:

export default connect((state) => ({
  token: state.userSession.token,

and there is a condition so that the Anontools component is only rendered if there is no token (i.e. if the user is anonymous / not logged in):

              {!this.props.token && (
                <div className="tools">
                  <Anontools />