hector-react-hooks
Hector React hooks
This package also installs hector-metamask and hector packages.
Install
Npm:
npm install @qhecuba/hector-react-hooks
Yarn:
yarn add @qhecuba/hector-react-hooks
Usage
const [status, connect, getWallet] = useConnect(wallets.metamask());
Example
import React from "react";
import { useConnect, wallets } from "@qhecuba/hector-react-hooks";
import { useEffect } from "react";
function App() {
const [status, connect, getWallet] = useConnect(wallets.metamask());
useEffect(() => {
connect();
getWallet();
}, []);
return (
<div className="App">
<h1>{status.isConnected ? "Connected" : "Not connected"}</h1>
<p>Wallet: {status.wallet}</p>
<button onClick={connect}>Connect</button>
</div>
);
}
export default App;