Skip to content
English

React

The React panel has two tabs. Components shows your app’s live component tree and lets you inspect a component’s props, hooks, state and context. Profiler records renders and shows how long each component took and why it rendered.

Setting up React in the SDK

The React panel's Components tab with a component selected and its props and hooks open

The Components tab opens with the tree fully expanded. Each row shows the component’s name, its key if it has one, and a Memo, ForwardRef, Class or Suspense tag for those kinds of component. Components without a name show as Anonymous. Use Expand all and Collapse all in the toolbar to open or close every branch.

Hover a row to highlight that component in the running app.

The native views React Native renders, such as RCTView, are hidden. Turn on Show host components to add them to the tree. This also changes the tree in React Native DevTools.

Type in Search components… to find components whose name contains the text, ignoring case. Matches are highlighted in the tree rather than filtered, and branches open to show the current match. Press Enter or use Next match and Previous match to move between them.

Select a component to open it on the right. Props is always shown, and Hooks, State and Context appear when the component has them. Values update while the component stays selected, and are read-only.

Rendered by lists the components that rendered this one, nearest first. Click one to select it in the tree.

Hooks are listed by type, such as State. Load hook names reads their variable names from the app’s source maps, so they show as State(count). Load them again after the app reloads.

On the Profiler tab, click Record, use the app, then click Stop. Starting a new recording replaces the last one, and Clear recording discards it.

If you leave the React panel while recording, recording carries on for 30 seconds, then stops. A recording is lost if the app disconnects.

The Profiler tab showing a recorded commit's flame graph, with a slow component selected and the reasons it rendered

Each time React updates the screen it makes a commit. The strip at the top has a bar for each commit, taller and hotter in colour the longer it took compared with the slowest. Click a bar, or use Previous commit and Next commit, to open a commit. Its duration shows at the right.

The flame graph shows the selected commit’s tree, one row per level. A bar’s width is the time that component and its children take to render. Components that rendered in the commit are coloured from cool to hot by their own render time, compared with the slowest component in the commit. Components that didn’t render are grey. Hover a bar to see its times, and click it to select it and zoom in on it.

Caused by, on the right, lists the components that triggered the commit. Select a bar to see its own time and its time including children, and under Why did this render?, one or more of:

  • First render: it mounted in this commit.
  • Props changed, with the names of the props.
  • State changed, with the names of the state keys, for class components.
  • Hooks changed, with the hooks that changed. A useState update shows here.
  • Context changed.
  • Its parent rendered: none of the above changed.

Click Select in Components to open the component on the Components tab.

  • Props, state and hooks can’t be edited from the panel, and profiles can’t be saved or loaded.
  • React Native DevTools is using the component inspector: only one tool can use React’s component inspector at a time, and React Native DevTools has taken it over. Click Reconnect to take it back.
  • The React panel needs React Native 0.76 or later: the app doesn’t expose React’s developer tools. Check it is a development build.
  • Couldn’t read the component tree from the app: click Reconnect.
  • Connect an app to inspect its React components: check the app is running and the Metro port in Settings > Connection matches the one Metro is on.