---
title: "React DevTools"
description: "Inspect the components, props and hooks of a running GTKX app and profile its renders with the standalone React DevTools."
---

# React DevTools

[React DevTools](https://react.dev/learn/react-developer-tools) inspects a running GTKX app during development. An app has no browser to host the DevTools extension, so GTKX connects to the standalone version instead.

## Start DevTools

Start DevTools in its own terminal. It is an Electron app, so it needs a display, and npx downloads it on first use.

```bash
npx react-devtools
```

Then start the app with `--devtools`. In a scaffolded project, pass the flag through the package script, as in `npm run dev -- --devtools`.

```bash
npx gtkx dev --devtools
```

Either side can start first. The app connects as soon as DevTools listens and reconnects when you reopen DevTools. The connection lasts through Fast Refresh, and `gtkx dev` connects again after it restarts the app. Without `--devtools`, a session does not load DevTools support, and production builds never include it.

DevTools listens on port 8097. To use another port, set `REACT_DEVTOOLS_PORT` for both commands:

```bash
REACT_DEVTOOLS_PORT=8098 npx react-devtools
REACT_DEVTOOLS_PORT=8098 npx gtkx dev --devtools
```

## Inspect components

The **Components** tab shows the component tree. Each GTKX element is one component named after its JSX name, such as `GtkButton`; elements that their parent creates, such as stack pages, also show an internal `LazyElement` below them. Select a component to read and edit its props, hooks and state; edits apply to the running app. Components compiled by the [React Compiler](/guide/configuration-and-codegen), which GTKX enables by default, carry a **Memo** badge.

The **Profiler** tab records renders. Start recording, use the app, then stop to see which components rendered in each commit and how long they took.

## Locate widgets

Hovering a component in the tree outlines the widgets it renders. The outline does not change the layout, and it disappears when the pointer leaves the tree, when DevTools disconnects or when the widget is removed.

To find the component behind a widget, press the button for selecting an element at the top left of the **Components** tab, then click the widget in the app. DevTools selects the element that created it, such as `GtkButton`, and the click does not reach the app. Picking ends after that click, or when you press the button again. It covers the windows and popovers that are open when it starts.
