Skip to content

Function inspectReactElement() ​

inspectReactElement(element: ReactElementLike, options?: InspectionOptions): string

Source: inspect.ts

Returns a string representation of a React element.

Parameters ​

element ​

ReactElementLike

The React element to inspect.

options? ​

InspectionOptions

Optional inspection options.

Returns ​

string

The resulting string.

Example ​

Note: The following example omits the options parameter for simplicity. In reality, the return values will contain ANSI escape codes unless you explicitly set colors to false.

tsx
inspect(<h1>Example</h1>) === "<h1>Example</h1>"

Built by Prozilla