Hook to create an imperative method for a component which forwards calls to another component.
export declare function useMethodFrom(provider: Handle | null, methodName: string, defaultVal?: any): void;
|provider||a Handle an Element that has method |
|methodName||The name that will be used for both the imperative method created on the invoking component and that will be invoked on the provider component.|
|defaultVal||The value that will be returned if |
Creates an imperative method named
methodName on the component from which this hook is invoked, which calls the imperative method of the same name on the component instance referenced by
When this component's method
methodName is called by another component, typically via
provider does not reference a valid Element,
defaultVal will be returned. If
methodName does not exist on
provider or is not a function, an error will be thrown. Otherwise, the provider Element's
methodName method will be invoked and its return value returned to the caller.