RE

React Shallow Renderer

react-shallow-renderer

React package for shallow rendering.

React Native Libraries
react
react-native
react-testing
react-shallow-renderer
React Native Libraries
javascript
npm
frontend
open source
ui
Stars
37
Weekly
2.9M
Open issues
25
Bundle
~25 kB

Installation

npm install react-shallow-renderer

Code example

import { View, Text, StyleSheet } from "react-native";
import { ShallowRenderer } from "react-shallow-renderer";

export function Example() {
  return (
    <View style={styles.box}>
      <Text style={styles.title}>React Shallow Renderer</Text>
      <ShallowRenderer />
    </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 ljharb
  • 2.9M weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~25 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • 25 open issues on GitHub

FAQs

Alternatives & similar libraries