useIdentify()

Use the useIdentify() hook to identify users when they log in or sign up.

Identify a User

The useIdentify() hook is used to identify a user when they log in or sign up.

pages/login.tsx
import { useIdentify } from '@journium/nextjs';

function LoginPage() {
  const identify = useIdentify();

  const handleLogin = async (credentials) => {
    const user = await authenticateUser(credentials);
    
    identify(user.id, {
      name: user.name,
      email: user.email,
      plan: user.plan
    });
  };

  return (
    <LoginForm onSubmit={handleLogin} />
  );
}

Last updated on

On this page