---
title: "useDataEngine hook"
description: "Get access to the Data Engine instance for non-React contexts."
url: https://developers.dhis2.org/docs/app-runtime/hooks/useDataEngine
source: https://github.com/dhis2/app-runtime/tree/master/docs/hooks/useDataEngine.md
---

# useDataEngine hook

Get access to the [Data Engine](https://developers.dhis2.org/docs/app-runtime/advanced/DataEngine.md) instance for non-React contexts.

## Basic Usage:

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

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

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

:::info
See [Using with Redux](https://developers.dhis2.org/docs/app-runtime/advanced/redux.md) for an advanced example
:::
