useDataset

This hook fetches a dataset from one or multiple cubes via the public stats.oecd.org SDMX-JSON API.

The data format returned by the SDMX API is an awkward, deeply nested structure, not really suitable for consumption by UI components. This hook abstracts the access and transformation of that data so you can focus on the rendering logic.

Usage


















Use the transform function to convert the raw response from the SDMX-JSON API into something that is convenient for your rendering code. The function call is memoized, so try to perform any expensive operations there instead of during rendering.

Try to make the transform function such that it converts the SDMX.Response into a format that follows the tidy data principles. This allows us to reuse the transform function across multiple modules. See also the various transformN functions in components/dataset/transforms/*.