@ic-reactor/react 0.1.1 → 0.1.2
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 +4 -13
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,21 +35,11 @@ First, create an actor declaration file:
|
|
|
35
35
|
import { canisterId, createActor } from "declaration/actor"
|
|
36
36
|
import { createReActor } from "@ic-reactor/core"
|
|
37
37
|
|
|
38
|
-
export const {
|
|
38
|
+
export const { useQueryCall, useUpdateCall } = createReActor((agent) =>
|
|
39
39
|
createActor(canisterId, { agent })
|
|
40
40
|
)
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Wrap your app with the `ReActorProvider` component:
|
|
44
|
-
|
|
45
|
-
```jsx
|
|
46
|
-
// App.jsx
|
|
47
|
-
|
|
48
|
-
<ReActorProvider>
|
|
49
|
-
<Balance principal={principal} />
|
|
50
|
-
</ReActorProvider>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
43
|
Then, use the `useQueryCall` hook to call your canister method:
|
|
54
44
|
|
|
55
45
|
```jsx
|
|
@@ -81,10 +71,11 @@ export default Balance
|
|
|
81
71
|
|
|
82
72
|
The library provides various hooks and utilities for interacting with IC actors:
|
|
83
73
|
|
|
74
|
+
- `useActorStore`: Hook for managing actor states.
|
|
75
|
+
- `useAuthStore` Hook for managing authentication states.
|
|
76
|
+
- `useAuthClient`: Hook for managing authentication with the IC blockchain.
|
|
84
77
|
- `useQueryCall`: Hook for querying data from an actor.
|
|
85
78
|
- `useUpdateCall`: Hook for updating data in an actor.
|
|
86
|
-
- `useReActor`: Hook to access the global actor state.
|
|
87
|
-
- `ReActorProvider`: React context provider for ReActor state.
|
|
88
79
|
- Additional hooks for handling loading, errors, authentication, and more.
|
|
89
80
|
|
|
90
81
|
For detailed API usage and options, please refer to the [documentation](#).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A React library for interacting with Dfinity actors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@dfinity/candid": "0.20",
|
|
41
41
|
"@dfinity/identity": "^0.20",
|
|
42
42
|
"@dfinity/principal": "^0.20",
|
|
43
|
-
"@ic-reactor/store": "^0.1.
|
|
43
|
+
"@ic-reactor/store": "^0.1.2",
|
|
44
44
|
"zustand": "4.4",
|
|
45
45
|
"zustand-utils": "^1.3"
|
|
46
46
|
},
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@peculiar/webcrypto": "1.4",
|
|
49
49
|
"react": ">=16.8"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "6710ddba717421913c2a9765e7c626fea204e2e7"
|
|
52
52
|
}
|