# @cypress/react Mount React components in the open source [Cypress.io](https://www.cypress.io/) test runner **v7.0.0+** > **Note:** This package is bundled with the `cypress` package and should not need to be installed separately. See the [React Component Testing Docs](https://docs.cypress.io/guides/component-testing/quickstart-react#Configuring-Component-Testing) for mounting React components. Installing and importing `mount` from `@cypress/react` should only be used for advanced use-cases. ## Install - Requires Cypress v7.0.0 or later - Requires [Node](https://nodejs.org/en/) version 12 or above ```sh npm install --save-dev @cypress/react ``` ## Run Open cypress test runner ``` npx cypress open --component ``` If you need to run test in CI ``` npx cypress run --component ``` For more information, please check the official docs for [running Cypress](https://on.cypress.io/guides/getting-started/opening-the-app#Quick-Configuration) and for [component testing](https://on.cypress.io/guides/component-testing/writing-your-first-component-test). ## API - `mount` is the most important function, allows to mount a given React component as a mini web application and interact with it using Cypress commands - `createMount` factory function that creates new `mount` function with default options - `unmount` removes previously mounted component, mostly useful to test how the component cleans up after itself - `mountHook` mounts a given React Hook in a test component for full testing, see `hooks` example ## Examples ```js import React from 'react' import { mount } from '@cypress/react' import { HelloWorld } from './hello-world.jsx' describe('HelloWorld component', () => { it('works', () => { mount() // now use standard Cypress commands cy.contains('Hello World!').should('be.visible') }) }) ``` Look at the examples in [cypress/component](cypress/component) folder. Here is the list of examples showing various testing scenarios. ## Options In most cases, the component already imports its own styles, thus it looks "right" during the test. If you need another CSS, the simplest way is to import it from the spec file: ```js // src/Footer.spec.js import './styles/main.css' import Footer from './Footer' it('looks right', () => { // styles are applied mount(