Skip to main content

useDataEngine hook

Get access to the Data Engine instance for non-React contexts.

Basic Usage:

import { useDataEngine } from '@dhis2/app-runtime'

// Within a functional component body
const engine = useDataEngine()

// later...
engine.query(query)
engine.mutate(mutation, {
variables: {
id: 'xyz123',
},
})

See Using with Redux for an advanced example