shallowly
Version:
Shallowly: Modern shallow renderer for React 18+. Enzyme-compatible API, 2x faster, with TypeScript support.
18 lines (17 loc) • 706 B
TypeScript
/**
* Converts a React element to a string ignoring props, while keeping the
* nested structure. Useful for lightweight snapshots.
*
* @param {React.ReactNode} element - Element or node to render.
* @param {number} [indent] - Current indentation in spaces.
* @returns {string} String representation of the tree.
*/
export function renderToString(element: React.ReactNode, indent?: number): string;
/**
* Converts a React element to a single-line string ignoring props.
*
* @param {React.ReactNode} element - Element or node to render.
* @returns {string} One-line representation of the tree.
*/
export function renderToInlineString(element: React.ReactNode): string;
import React from 'react';