Less than 1 minute


This section describes how to obtain HALO identity in react.

Logging in

The user's identity can be obtained by a react application with the useIdentity hook:

import React from 'react';
import { useIdentity } from '@dxos/react-client';

export const MyComponent = () => {
  const identity = useIdentity({ login: true });
  return <>{/* ... */}</>;

The object returned is of type Identity.

The { login: true } tells HALO to log the user in using the HALO application. Omitting this enables the developer to receive null from this hook when the user has no existing HALO identity on this device.


When using { login: true } the hook will fire twice. Once with null, and then again with an identity when one has been established.

Using with React Router

If using react-routeropen in new window the component RequireIdentity from @dxos/react-appkit automatically redirects the user to the HALO app when no identity is found, and returns back when established.

import React from 'react';
import { useRoutes } from 'react-router-dom';
import { RequireIdentity } from '@dxos/react-appkit';

export const Routes = () => {
  return useRoutes([
      element: <RequireIdentity />,
      children: [
        // ... other routes will fire only once identity is established

Once identity is established, a space must be created or joined in order to manipulate data.