react-deso-protocol
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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);

  ...
};

Readme

Keywords

none

Package Sidebar

Install

npm i react-deso-protocol

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

15.3 kB

Total Files

13

Last publish

Collaborators

  • jackson-dean