@meteor-web3/hooks
v1.0.24
Published
React hooks of meteor app.
Downloads
29
Readme
Meteor Hooks
Overview
This repository contains React
hooks for meteor primitives, making it
easier to create your dApp logic and components.
Install
pnpm install @meteor-web3/hooks
Example
import provider
import { MeteorContextProvider } from "@meteor-web3/hooks";
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<MeteorContextProvider>
<App />
</MeteorContextProvider>
);
use store
import { useStore } from "@meteor-web3/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 meteor-hooks usage in dapp-examples.
Documentation
View hooks API Doc.