Skip to main content

Checking if a session exists on the frontend

import React from "react";import { useSessionContext } from 'supertokens-auth-react/recipe/session'; 
// Your dashboard componentfunction Dashboard(props: any) {      let session = useSessionContext();
      if (session.loading) {            // Session loading is generally very fast, so we do not recommend you to use a loading screen here.            return null;      }
      if (session.doesSessionExist) {            // TODO..      } else {            // TODO..      }}
What type of UI do you want to use?
Custom UI
Pre built UI