Skip to main content

@dxos/react-client

Less than 1 minute

@dxos/react-client

React client API

Installation

pnpm i @dxos/react-client

Usage

The snippet below illustrates a self-contained DXOS application that uses providers to create the client and instantiate a user profile.


import React from 'react';
import { useClient, ClientProvider } from '@dxos/react-client';
import { createRoot } from 'react-dom/client';

const App = () => {
  const client = useClient();
  const space = useSpaces();
  return (
    <pre>{JSON.stringify(client.info())}</pre>
  );
};

const Root = () => (
  <ClientProvider>
    <App />
  </ClientProvider>
);

createRoot(document.getElementById('root')!)
  .render(<Root/>);

Documentation

Storybooks

The HALO Invitation Story demonstrates multiple clients (devices) joining the same HALO. Demo videoopen in new window.

The Space Invitation Story demonstrates multiple clients creating and sharing spaces. Demo videoopen in new window.

DXOS Resources

Contributions

Your ideas, issues, and code are most welcome. Please take a look at our community code of conductopen in new window, the issue guideopen in new window, and the PR contribution guideopen in new window.

License: MIT Copyright 2022 © DXOS