Skip to main content

Data Queries

The Query type is used to define declarative data requests. It is required input for the useDataQuery hook and DataQuery component.

Query

A query is a map of names to QueryDefinition objects. The name can be any string. Multiple QueryDefinition components of a single Query will be fetched in parallel if possible.

i.e.

const query = {
myData: {
resource: 'indicators',
},
}

QueryDefinition

PropertyTypeDescription
resourcestringrequiredThe path to the resource being requested, i.e. indicators.
idstring or () => stringOptional, when specified indicates that a particular instance of a collection will be requested
paramsObject or () => ObjectA dictionary of properties which are translated into querystring parameters when the data is fetched

See the Query type definition for more information