Hooks
The DHIS2 Application Runtime supports React Hooks (introduced in React 16.8). The following hooks are supported:
- useConfig - Access the raw application configuration object
- useDataQuery - Fetch data from the DHIS2 Core server API without worrying about HTTP requests!
- useDataMutation - Mutate resources in the DHIS2 Core server API without worrying about HTTP requests!
- useDataEngine (Advanced) - Access the underlying Data Engine instance
- useAlert - Add an alert to the central alerts-context
- useAlerts - Read the alerts from the alerts-context
While these Hooks are incredibly powerful and usually preferable, some Components are also provided which conveniently wrap their corresponding Hooks.