> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kerne.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Waitlist & invitations

> A waitlist form, and checking an invitation before sign-up

## Waitlist

```tsx theme={"system"}
import { useState } from 'react';
import { useWaitlist } from '@kerne/react';

function WaitlistForm() {
  const { join } = useWaitlist();
  const [email, setEmail] = useState('');
  const [joined, setJoined] = useState(false);

  if (joined) return <p>You're on the list.</p>;

  return (
    <form
      onSubmit={async (event) => {
        event.preventDefault();
        await join({ email });
        setJoined(true);
      }}
    >
      <input
        type="email"
        value={email}
        onChange={(event) => setEmail(event.target.value)}
        required
      />
      <button type="submit">Join the waitlist</button>
    </form>
  );
}
```

`join()` also takes `name` and `metadata`, and always resolves `{ success: true }`. `@kerne/react/ui` has a ready-made `<WaitlistForm>`. Listing and removing entries is done from your backend: see [Waitlist](https://docs.kerne.io/sdks/server/waitlist-invitations.md#waitlist).

## Invitations

Check an invitation before showing your sign-up form:

```tsx theme={"system"}
import { useInvitation } from '@kerne/react';

function SignUpPage({ inviteToken }: { inviteToken?: string }) {
  const { result, isLoading } = useInvitation({ token: inviteToken });

  if (isLoading) return <Spinner />;
  if (!result?.valid) return <InvalidInvitation />;
  return <RegisterForm invitationToken={inviteToken} />;
}
```

For a code, pass `{ code }` and gate on `result.canUse`: a code can be valid but used up. Then pass the same token or code to [`register()`](https://docs.kerne.io/sdks/client/react/authentication#log-in-and-register). Invitations are created and revoked from your backend: see [Invitations](https://docs.kerne.io/sdks/server/waitlist-invitations.md#invite-by-email).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.