• Provides a set of React hooks designed for interacting with actors in an Internet Computer (IC) project using the React framework and Zustand for state management.

    Type Parameters

    Parameters

    • actorManager: types.ActorManager<A>

      An instance of ActorManager containing methods and properties to manage actors, including the actorStore, canisterId, visitFunction, callMethod, and initialize function.

    Returns ActorHooksReturnType<A>

    An object containing several hooks and utility functions for interacting with actors, managing state, and invoking actor methods.

    Hooks included:

    • initialize: Function to initialize actor management.
    • useActorState: Hook for accessing the actor's state including the canister ID.
    • useVisitMethod: Hook for memoizing a method visit service for a given actor method name.
    • useQueryCall: Hook specifically designed for query calls to actors with features such as automatic refetching on mount and at specified intervals.
    • useUpdateCall: Hook specifically designed for update calls to actors with features such as error handling and loading state management.

    Each hook is designed to simplify the process of interacting with actors in IC projects by abstracting away the complexity of state management, error handling, and method invocation.