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 React from 'react';
import { useIdentify } from '@journium/react';

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

  const handleLogin = async (email, password) => {
    const user = await loginUser(email, password);
    
    identify(user.id, {
      name: user.name,
      email: user.email
    });
  };

  return (
    <form onSubmit={handleLogin}>
      {/* Login form fields */}
    </form>
  );
}

Last updated on

On this page