Optional
deprecatedLegacyContext: any<ActorManagerProvider actorManager={yourActorManager}>
<YourComponent />
</ActorManagerProvider>
This setup ensures that YourComponent
and any of its children can interact with the specified IC actor manager through the context provided by ActorManagerProvider
.
Optional
propUsed to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.
We recommend using TypeScript instead of checking prop types at runtime.
Optional
contextOptional
defaultUsed to define default values for the props accepted by the component.
type Props = { name?: string }
const MyComponent: FC<Props> = (props) => {
return <div>{props.name}</div>
}
MyComponent.defaultProps = {
name: 'John Doe'
}
Optional
displayUsed in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.
const MyComponent: FC = () => {
return <div>Hello!</div>
}
MyComponent.displayName = 'MyAwesomeComponent'
ActorManagerProvider
is a React functional component that serves as a context provider for IC actor managers within a React application. It wraps child components, providing them access to actor-specific manager functionalities based on the provided actor manager and configuration.Props:
actorManager
: ActorManager - The actor manager object containing the actor manager functionalities.children
: React Node - The child components that will have access to the actor manager context.Behavior:
actorManager
. Throws an error if it is missing, ensuring that the actor manager is always available for actor operations.useMemo
to memoize theactorManager
, optimizing for performance by avoiding unnecessary recalculations.actorManager
is available, effectively providing them access to the actor manager context.