Package Exports
- @tezos-contrib/react-wallet-provider
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tezos-contrib/react-wallet-provider) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@tezos-contrib/react-wallet-provider
Previously:
@tz-contrib/react-wallet-provider
A react provider for Dapps to easily setup connection to Beacon/Taquito wallets
Installation
- Npm
npm install --save @tezos-contrib/react-wallet-provider @airgap/beacon-sdk @taquito/beacon-wallet- Yarn
yarn add @tezos-contrib/react-wallet-provider @airgap/beacon-sdk @taquito/beacon-walletExample usage
import { WalletProvider, useWallet } from '@tezos-contrib/react-wallet-provider';
export default function App() {
return (
<WalletProvider name="my-example-app" clientType="beacon">
<Example />
</WalletProvider>
);
}
function Example() {
const { connected, activeAccount, connect, disconnect } = useWallet();
return (
<div>
<header>
{!connected && <button onClick={connect}>Connect</button>}
{connected && (
<button onClick={disconnect}>Disconnect from {activeAccount?.address}</button>
)}
</header>
</div>
);
}