Interface ICachedDataComponentProps<T>

interface ICachedDataComponentProps<T> {
    dataKey?: string;
    children?: ((data: T, component: CachedDataComponent<T, ICachedDataComponentProps<T>>) => Element);
    load?: ((component: CachedDataComponent<T, ICachedDataComponentProps<T>>) => Promise<T>);
    LoaderComponent?: ReactNode;
    onData?: ((data: T) => void);
    onError?: ((error: any) => void);
    refresh?: boolean;
    renderError?: ((error: any) => Element);
    transformData?: ((data: T) => T);
    update?: ((data: T) => Promise<T>);
}

Type Parameters

  • T

Hierarchy

Properties

dataKey?: string

The key with which are the data stored in the store. The property is required if the component is not inherited.

children?: ((data: T, component: CachedDataComponent<T, ICachedDataComponentProps<T>>) => Element)

Function as children for rendering the data. The property is required if the data component is not inherited.

load?: ((component: CachedDataComponent<T, ICachedDataComponentProps<T>>) => Promise<T>)

Function to load the data. The property is required if the data component is not inherited.

LoaderComponent?: ReactNode

The component to render while the data are loading.

onData?: ((data: T) => void)

Function called when the data are received.

onError?: ((error: any) => void)

Function called if the error occurs during the request.

refresh?: boolean

Indicates if the component should force load the data on mount.

renderError?: ((error: any) => Element)

Function for rendering the error.

transformData?: ((data: T) => T)

Transforms the data before storing.

update?: ((data: T) => Promise<T>)

Function to updated data in the store. The property is required if the data component is not inherited.