Use the hook useSignInAnonymous to sign in a user anonymously.

As a result, the user will have the anonymous role and subsequent set of permissions. The user can then be converted to a regular user at a later stage using email+password sign-up, passwordless email (magic link), or passwordless SMS.

const { signInAnonymous, isLoading, isSuccess, isError, error } =
  useSignInAnonymous()

console.log({ isLoading, isSuccess, isError, error })

const handleFormSubmit = async (e) => {
  e.preventDefault()

  await signInAnonymous()
}