Skip to content
rw3iss Auth

GuestOnly

atom @rw3iss/auth-client/preact/atoms/GuestOnly framework-adapters/preact/components/atoms/GuestOnly.tsx ↗

Inverse of ProtectedRoute — render children only when NOT authenticated. Useful for /login and /register pages that should redirect away when an authenticated user lands on them.

Usage

import { GuestOnly } from '@rw3iss/auth-client/preact/atoms';
<GuestOnly
children={<></>}
/>

Props

NameTypeDescription
childrenComponentChildren(required)
fallbackComponentChildrenRendered when the user is authenticated.
loadingComponentChildren
clientAuthClient