@ic-reactor/react 1.7.4 → 1.7.5
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/dist/provider/actor.d.ts +22 -0
- package/dist/provider/actor.js +23 -1
- package/package.json +2 -2
package/dist/provider/actor.d.ts
CHANGED
|
@@ -26,3 +26,25 @@
|
|
|
26
26
|
* This setup ensures that `YourComponent` and any of its children can interact with the specified IC actor through the context provided by `ActorProvider`.
|
|
27
27
|
*/
|
|
28
28
|
export declare const ActorProvider: import("react").FC<import("../context/types").ActorProviderProps>;
|
|
29
|
+
/**
|
|
30
|
+
* `ActorHookProvider` is a React functional component that serves as a context provider for IC actor hooks within a React application.
|
|
31
|
+
* It wraps child components, providing them access to actor-specific hooks and functionalities based on the provided actor hooks and configuration.
|
|
32
|
+
*
|
|
33
|
+
* Props:
|
|
34
|
+
* - `hooks`: ActorHooksReturnType - The actor hooks object containing the various actor interaction hooks.
|
|
35
|
+
* - `children`: React Node - The child components that will have access to the actor hooks context.
|
|
36
|
+
*
|
|
37
|
+
* Behavior:
|
|
38
|
+
* - Validates the presence of the `hooks` object. Throws an error if it is missing, ensuring that the actor hooks are always available for actor operations.
|
|
39
|
+
* - Utilizes `useMemo` to memoize the `hooks` object, optimizing for performance by avoiding unnecessary recalculations.
|
|
40
|
+
* - Renders the child components once the `hooks` object is available, effectively providing them access to the actor hooks context.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```jsx
|
|
44
|
+
* <ActorHookProvider hooks={yourActorHooks}>
|
|
45
|
+
* <YourComponent />
|
|
46
|
+
* </ActorHookProvider>
|
|
47
|
+
* ```
|
|
48
|
+
* This setup ensures that `YourComponent` and any of its children can interact with the specified IC actor hooks through the context provided by `ActorHookProvider`.
|
|
49
|
+
*/
|
|
50
|
+
export declare const ActorHookProvider: import("react").FC<import("../context/types").ActorHookProviderProps<import("@ic-reactor/core/dist/types").BaseActor>>;
|
package/dist/provider/actor.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ActorProvider = void 0;
|
|
6
|
+
exports.ActorHookProvider = exports.ActorProvider = void 0;
|
|
7
7
|
const hooks_1 = __importDefault(require("../hooks/actor/hooks"));
|
|
8
8
|
/**
|
|
9
9
|
* `ActorProvider` is a React functional component that serves as a context provider for IC actor interactions within a React application.
|
|
@@ -32,3 +32,25 @@ const hooks_1 = __importDefault(require("../hooks/actor/hooks"));
|
|
|
32
32
|
* This setup ensures that `YourComponent` and any of its children can interact with the specified IC actor through the context provided by `ActorProvider`.
|
|
33
33
|
*/
|
|
34
34
|
exports.ActorProvider = hooks_1.default.ActorProvider;
|
|
35
|
+
/**
|
|
36
|
+
* `ActorHookProvider` is a React functional component that serves as a context provider for IC actor hooks within a React application.
|
|
37
|
+
* It wraps child components, providing them access to actor-specific hooks and functionalities based on the provided actor hooks and configuration.
|
|
38
|
+
*
|
|
39
|
+
* Props:
|
|
40
|
+
* - `hooks`: ActorHooksReturnType - The actor hooks object containing the various actor interaction hooks.
|
|
41
|
+
* - `children`: React Node - The child components that will have access to the actor hooks context.
|
|
42
|
+
*
|
|
43
|
+
* Behavior:
|
|
44
|
+
* - Validates the presence of the `hooks` object. Throws an error if it is missing, ensuring that the actor hooks are always available for actor operations.
|
|
45
|
+
* - Utilizes `useMemo` to memoize the `hooks` object, optimizing for performance by avoiding unnecessary recalculations.
|
|
46
|
+
* - Renders the child components once the `hooks` object is available, effectively providing them access to the actor hooks context.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```jsx
|
|
50
|
+
* <ActorHookProvider hooks={yourActorHooks}>
|
|
51
|
+
* <YourComponent />
|
|
52
|
+
* </ActorHookProvider>
|
|
53
|
+
* ```
|
|
54
|
+
* This setup ensures that `YourComponent` and any of its children can interact with the specified IC actor hooks through the context provided by `ActorHookProvider`.
|
|
55
|
+
*/
|
|
56
|
+
exports.ActorHookProvider = hooks_1.default.ActorHookProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "A React library for interacting with Internet Computer canisters",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react": ">=16.8",
|
|
48
48
|
"zustand": "4.5"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "6ff9d0880ddb86dcd4d8d66ea1480da44a93212e"
|
|
51
51
|
}
|