React Test Renderer
react-test-renderer
React package for snapshot testing.
React Native Libraries
react
react-native
react-testing
react-test-renderer
React Native Libraries
javascript
npm
frontend
open source
ui
Stars
250k
Weekly
6.4M
Open issues
1352
Bundle
~15 kB
Installation
npm install react-test-rendererCode example
import { View, Text, StyleSheet } from "react-native";
import { TestRenderer } from "react-test-renderer";
export function Example() {
return (
<View style={styles.box}>
<Text style={styles.title}>React Test Renderer</Text>
<TestRenderer />
</View>
);
}
const styles = StyleSheet.create({
box: { flex: 1, alignItems: "center", justifyContent: "center", gap: 8 },
title: { fontSize: 18, fontWeight: "600" },
});Pros & cons
Pros
- Actively maintained by fb
- 6.4M weekly downloads. Battle tested
- MIT licensed
Considerations
- Adds roughly ~15 kB to your bundle
- Needs client-only rendering in SSR frameworks
- 1352 open issues on GitHub