ReactSignedIn

Renders children only when the user is authenticated. It reads the a_s_b cookie on the client side. No provider required and no SDK calls.

Usage

Wrap protected UI that should only be visible to signed-in users.

Jsx
1import { ReactSignedIn } from "@neuctra/authix";
2
3export default function Page() {
4  return (
5    <ReactSignedIn>
6      <Dashboard />
7    </ReactSignedIn>
8  );
9}
Jsx
1// fallback renders when user is NOT authenticated
2<ReactSignedIn fallback={<a href="/login">Sign in</a>}>
3  <Dashboard />
4</ReactSignedIn>

Props

Configuration options for conditional rendering.

PropTypeRequiredDescription
childrenReactNodeYesRendered when user is authenticated.
fallbackReactNode | () => ReactNodeNoRendered when user is NOT authenticated.

Loading Behavior

During initial cookie check, the component returns null to avoid hydration mismatch. After resolution: authenticated → children, unauthenticated → fallback.

Cookie Contract

The a_s_b cookie is a frontend auth flag used by both ReactSignedIn and ReactSignedOut. The HTTP-only session cookie is handled separately by the Neuctra Authix SDK during authentication flows.