shallowly
Version:
Shallowly: Modern shallow renderer for React 18+. Enzyme-compatible API, 2x faster, with TypeScript support.
11 lines (10 loc) • 463 B
TypeScript
/**
* Recursively converts a React element to a string that contains its props
* and nested children, preserving the original depth.
*
* @param {React.ReactNode} element - Element or node to render.
* @param {number} [indent=0] - Current indentation size in spaces.
* @returns {string} String representation of the tree.
*/
export function renderWithProps(element: React.ReactNode, indent?: number): string;
import React from 'react';