# react-test-renderer

> React package for snapshot testing.

Latest version **19.3.0** (published 2026-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-test-renderer
pnpm add react-test-renderer
yarn add react-test-renderer
bun add react-test-renderer
```

## Health

**Score 73/100 (B)** — status: active.

Positive: has types package; no vulnerabilities; has provenance; recently updated; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 19.3.0 |
| Published | 2026-09-09 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-test-renderer) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 250059 |
| Maintainers | fb, react-bot |
| Keywords | react, react-native, react-testing |

## Links

- npm: https://www.npmjs.com/package/react-test-renderer
- Repository: https://github.com/react/react
- Homepage: https://react.dev/
- Issues: https://github.com/react/react/issues
- npm.io page: https://npm.io/package/react-test-renderer

## Dependencies (2)

- [react-is](https://npm.io/package/react-is.md) ^19.3.0
- [scheduler](https://npm.io/package/scheduler.md) ^0.28.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 19.3.0 (latest) — 2026-09-09
- 0.0.0-experimental-019019be-20260911 (experimental) — 2026-09-11
- 19.3.0-canary-019019be-20260911 (canary) — 2026-09-11
- 19.0.8 (backport) — 2026-07-21
- 19.3.0-canary-d5736f09-20260507 (next) — 2026-05-08
- 19.0.0-rc.1 (rc) — 2024-11-14
- 19.0.0-beta-26f2496093-20240514 (beta) — 2024-05-14
- 19.3.0-canary-82c44beb-20260910 — 2026-09-10
- 0.0.0-experimental-82c44beb-20260910 — 2026-09-10
- 19.3.0-canary-1d34f91d-20260909 — 2026-09-09
- 0.0.0-experimental-1d34f91d-20260909 — 2026-09-09
- 0.0.0-experimental-6c0e1047-20260908 — 2026-09-08
- 19.3.0-canary-6c0e1047-20260908 — 2026-09-08
- 0.0.0-experimental-f1f7ed2a-20260904 — 2026-09-07
- 19.3.0-canary-f1f7ed2a-20260904 — 2026-09-07
- … 2844 more at https://npm.io/package/react-test-renderer/versions

## README

# `react-test-renderer` (DEPRECATED)

## Deprecation notice

`react-test-renderer` is deprecated and no longer maintained. It will be removed in a future version. As of React 19, you will see a console warning when invoking `ReactTestRenderer.create()`.

### React Testing

This library creates a contrived environment and its APIs encourage introspection on React's internals, which may change without notice causing broken tests. It is instead recommended to use browser-based environments such as jsdom and standard DOM APIs for your assertions.

The React team recommends [`@testing-library/react`](https://testing-library.com/docs/react-testing-library/intro) as a modern alternative that uses standard APIs, avoids internals, and [promotes best practices](https://testing-library.com/docs/guiding-principles).

### React Native Testing

The React team recommends @testing-library/react-native as a replacement for `react-test-renderer` for native integration tests. This React Native testing-library variant follows the same API design as described above and promotes better testing patterns.

## Documentation

This package provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment.

Essentially, this package makes it easy to grab a snapshot of the "DOM tree" rendered by a React DOM or React Native component without using a browser or jsdom.

Documentation: [https://reactjs.org/docs/test-renderer.html](https://reactjs.org/docs/test-renderer.html)

Usage:

```jsx
const ReactTestRenderer = require('react-test-renderer');

const renderer = ReactTestRenderer.create(
  <Link page="https://www.facebook.com/">Facebook</Link>
);

console.log(renderer.toJSON());
// { type: 'a',
//   props: { href: 'https://www.facebook.com/' },
//   children: [ 'Facebook' ] }
```

You can also use Jest's snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn't changed: https://jestjs.io/blog/2016/07/27/jest-14.html.

---
_Source: https://npm.io/package/react-test-renderer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
