@poolzfinance/reacthelper
v2.1.10
Published
### Reporting Bugs / Feature Requests
Downloads
295
Keywords
Readme
ReactHelper
Reporting Bugs / Feature Requests
Installation
You can install the package either using NPM or using Yarn
Using NPM
npm install @poolzfinance/reacthelper
Yarn
yarn add @poolzfinance/reacthelper
Usage
src/index.tsx
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import { ThePoolzProvider } from "@poolzfinance/reacthelper"
import App from "./App"
const rootElement = document.getElementById("root")
const root = createRoot(rootElement!)
root.render(
<StrictMode>
<ThePoolzProvider>
<App />
</ThePoolzProvider>
</StrictMode>
)
Connect MetaMask wallet
src/App.tsx
import { useThePoolz, useConnectWallet } from "@poolzfinance/reacthelper"
export default function App() {
const thePoolz = useThePoolz()
const { account } = thePoolz
const { isMetamask, connectMetamask } = useConnectWallet()
return (
<div>
<h1>ReactHelper</h1>
{account || (
<button
onClick={async () => {
try {
await connectMetamask()
} catch (error) {
console.error(error)
}
}}>
{!isMetamask && "Install"} Metamask
</button>
)}
</div>
)
}
Demo: SandBox