Hiyve Components - v1.0.0
    Preparing search index...

    Function useIdentitySafe

    • Safe version of useIdentity that returns null outside of an IdentityProvider.

      Useful for components that optionally integrate with identity — for example, a header component that shows user info when auth is available but still renders without it.

      Returns IdentityContextValue | null

      The IdentityContextValue, or null if no provider is found.

      function Header() {
      const identity = useIdentitySafe();
      return (
      <header>
      {identity?.isAuthenticated
      ? <span>{identity.user?.email}</span>
      : <a href="/login">Sign In</a>}
      </header>
      );
      }