0.0.3 • Published 12 months ago

react-deso-protocol v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

react-deso-protocol

This package provides a pre-defined context and context provider for using DeSo Identity with in react applications. Removes a lot of the typical boilerplate needed to sync DeSo Identity state.

Installation

npm i react-deso-protocol

Usage

Wrap your app in the DeSoIdentityProvider. NOTE: this may be a little different depending on how the root of your application is set up.

// index.ts
import { DeSoIdentityProvider } from 'react-deso-protocol';
import { App } from './App';

ReactDOM.createRoot(document.getElementById("root")).render(
  <React.StrictMode>
    <DeSoIdentityProvider>
      <App />
    </DeSoIdentityProvider>
  </React.StrictMode>

Now you can use DeSoIdentityContext anywhere in your app.

import { useContext } from 'react';
import { DeSoIdentityContext } from 'react-deso-protocol';

// MyCoolComponent.tsx
const MyCoolComponent = () => {
  // ... use any of these context properties anywhere in your app
  const { currentUser, alternateUsers, isLoading } = useContext(DeSoIdentityContext);

  ...
};
0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago