---
id: app/write-tests/component-testing/react/api
title: React API
description: API for mounting React components in Cypress tests.
section: app
source_path: docs/app/write-tests/component-testing/react/api.mdx
version: 066c46e056f0f322a0670d2d3aa4e6adaebfe717
updated_at: '2026-09-10T13:30:12.426Z'
---
# React API

The `cypress/react` module provides the following methods and interfaces for mounting and testing React components.

## mount

```
import { mount } from 'cypress/react'
```

<table><tbody><tr><td>Description</td><td>Mounts a React component into the DOM.</td></tr><tr><td>Signature</td><td><p>mount(jsx: React.ReactNode, options?: MountOptions, rerenderKey?: string): Cypress.Chainable&lt;MountReturn&gt;</p></td></tr><tr><td>Returns</td><td>Cypress.Chainable&lt;MountReturn&gt;</td></tr></tbody></table>

<table><caption>mount Parameters</caption><thead></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td>jsx</td><td>React.JSX.Element</td><td>The React component to mount.</td></tr><tr><td>options</td><td>MountOptions (optional)</td><td>The options for mounting the component</td></tr><tr><td>rerenderKey</td><td>string (optional)</td><td>A key to use to force a rerender.</td></tr></tbody></table>

### Example

```
import { mount } from '@cypress/react'
import { Stepper } from './Stepper'

it('mounts', () => {
  mount(<StepperComponent />)
  cy.get('[data-cy=increment]').click()
  cy.get('[data-cy=counter]').should('have.text', '1')
}
```

## getContainerEl

<table><tbody><tr><td>Description</td><td>Gets the root element used to mount the component.</td></tr><tr><td>Signature</td><td>() =&gt; HTMLElement</td></tr><tr><td>Returns</td><td>HTMLElement</td></tr></tbody></table>

## Interfaces

### MountOptions

<table><caption>members</caption><thead></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td>alias</td><td>string (optional)</td><td></td></tr><tr><td>ReactDom</td><td>MountReactComponentOptions.ReactDom (optional)</td><td></td></tr><tr><td>log</td><td>boolean (optional)</td><td>Log the mounting command into Cypress Command Log, true by default</td></tr><tr><td>strict</td><td>boolean (optional)</td><td><p>Render component in React <a href="https://reactjs.org/docs/strict-mode.html">strict mode</a> It activates additional checks and warnings for child components.</p></td></tr></tbody></table>

### MountReturn

Type that the `mount` function yields

<table><caption>members</caption><thead></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td>component</td><td>React.ReactNode</td><td><p>Render component in React <a href="https://reactjs.org/docs/strict-mode.html">strict mode</a> It activates additional checks and warnings for child components.</p></td></tr><tr><td>rerender</td><td><p>(component: React.ReactNode) =&gt; globalThis.Cypress.Chainable&lt;MountReturn&gt;</p></td><td>The component that was rendered.</td></tr></tbody></table>
