@dataverse/hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.39 • Public • Published

Dataverse logo


Dataverse Hooks

npm version npm License

Overview

This repository contains React hooks for dataverse primitives, making it easier to create your dApp logic and components.

Install

pnpm install @dataverse/hooks

Example

import provider

import { DataverseContextProvider } from "@dataverse/hooks";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
  <DataverseContextProvider>
    <App />
  </DataverseContextProvider>
);

use store

import { useStore } from "@dataverse/hooks";

const { state } = useStore();

use hooks

const { connectApp } = useApp({
  onSuccess: (result) => {
    console.log("connect app success, result:", result);
  },
});

const { createdStream: publicPost, createStream: createPublicStream } = useCreateStream({
  streamType: StreamType.Public,
  onSuccess: (result: any) => {
    console.log("create public stream success:", result);
  },
});

You can find more dataverse-hooks usage in dapp-examples.

Documentation

View hooks API Doc.

Readme

Keywords

none

Package Sidebar

Install

npm i @dataverse/hooks

Weekly Downloads

7

Version

1.0.39

License

MIT

Unpacked Size

364 kB

Total Files

223

Last publish

Collaborators

  • fuxiangyu
  • qblee
  • ownershiplabs-dataverse
  • tagbug
  • canvasl
  • z2m2020