DataObserver 📌

Observes data to check if it is data is loading, loaded or empty. The resulting flags are passed on to the children function. These flags may be used to show different UIs, i.e. loading state, empty state, etc.

System Component 📌

This component is shipped with BlueBase Core.

Usage

<DataObserver data={dataObj} >
{
    ({data, loading, empty}) => {
        // Render UI based on params
    }
}
</DataObserver>

Properties

prop

type

required

default

description

isLoading

(props) => boolean

no

-

A function used to check if data is loading.

isEmpty

(props) => boolean

no

-

A function used to check if data is empty.

loading

boolean

no

-

Loading flag.

data

any

no

-

Input data.

children

ReactNode | Function

no

-

Children, data is passed in the param object of the render prop function. This object is typed as DataObserverChildrenProps.

testID

string

no

-

Used to locate this view in end-to-end tests.

Last updated