@openshift-console/dynamic-plugin-sdk
Version:
Provides core APIs, types and utilities used by dynamic plugins at runtime.
18 lines (17 loc) • 746 B
TypeScript
import { UseK8sWatchResource } from '../../../extensions/console-types';
/**
* Hook that retrieves the Kubernetes resource along with their respective status for loaded and error.
* @param initResource resources need to be watched as key-value pair, wherein key will be unique to resource and value will be options needed to watch for the respective resource.
* @returns An array with first item as resource(s), second item as loaded status and third item as error state if any.
* @example
* ```ts
* const Component: React.FC = () => {
* const watchRes = {
...
}
* const [data, loaded, error] = useK8sWatchResource(watchRes)
* return ...
* }
* ```
*/
export declare const useK8sWatchResource: UseK8sWatchResource;