Use the Value of isAuthenticated to Render Components Conditionality

Will Johnson
InstructorWill Johnson
Share this video with your friends

Social Share Links

Send Tweet
Published a year ago
Updated a year ago

The isAuthenticated value represents the authentication state of your users it's tracked by the Auth0 React SDK. This value returns true when the user has been authenticated and false they're when not. Use isAuthenticated to render UI elements conditionally depending on the authentication state of your users.

import { useAuth0 } from "@auth0/auth0-react";
import React from "react";
import { LoginButton } from "../../buttons/login-button";
import { LogoutButton } from "../../buttons/logout-button";
import { SignupButton } from "../../buttons/signup-button";

export const NavBarButtons = () => {
  const { isAuthenticated } = useAuth0();

  return (
    <div className="nav-bar__buttons">
      {!isAuthenticated && (
          <SignupButton />
          <LoginButton />
      {isAuthenticated && (
          <LogoutButton />

Authentication process doesn’t happen in your React application when using Auth0. Your React application will redirect your users to the Auth0 Universal Login page. Auth0 asks for credentials and redirects the user back to your application with the result of the authentication.

~ 30 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today