zano_web3 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,30 @@ zanoWallet.setWalletCredentials({
|
|
|
88
88
|
});
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
## Using the `useZanoWallet` Hook
|
|
92
|
+
|
|
93
|
+
The `useZanoWallet` hook is a custom React hook provided by the `zano_web3` library. It simplifies the process of interacting with the ZanoWallet extension in a React application.
|
|
94
|
+
|
|
95
|
+
This hook is designed to handle server-side rendering (SSR) limitations by ensuring that it only runs on the client-side. This means that any code using the `useZanoWallet` hook will not be executed during server-side rendering, but will work as expected once the application is running in the browser.
|
|
96
|
+
|
|
97
|
+
To use the `useZanoWallet` hook, you can import it from the `zano_web3` library and call it within a functional component:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { useZanoWallet } from 'zano_web3';
|
|
101
|
+
|
|
102
|
+
function MyComponent() {
|
|
103
|
+
|
|
104
|
+
const wallet = useZanoWallet({
|
|
105
|
+
// same params as for new ZanoWallet
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div>Your component...</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
|
|
91
115
|
## Requirements
|
|
92
116
|
|
|
93
117
|
- ZanoWallet browser extension must be installed.
|