Skip to main content

Overview

React Grab exports several utility functions for advanced use cases. These functions provide low-level access to React Grab’s internals.

Functions

getStack()

Get the React stack frames for a given element. Returns stack information from React’s internal fiber tree.
Element
required
The DOM element to get stack information for
StackFrame[] | null
Array of stack frames containing component information, or null if instrumentation is not active
Example:

formatElementInfo()

Format element information into a human-readable string. This is the same formatting used when copying element context.
Element
required
The DOM element to format information for
string
Formatted string containing element context (tag name, component name, file path, line number)
Example:

isInstrumentationActive()

Check if React instrumentation is currently active. Returns true if React Grab can access React’s internal fiber tree for debugging.
boolean
Whether React instrumentation is active
Example:

getGlobalApi()

Get the global React Grab API instance. Returns the API instance stored in window.__REACT_GRAB__ or the internal global reference.
ReactGrabAPI | null
The global API instance, or null if React Grab has not been initialized
Example:

setGlobalApi()

Set or clear the global React Grab API instance. This updates both window.__REACT_GRAB__ and the internal global reference.
ReactGrabAPI | null
required
The API instance to set globally, or null to clear
Example:

generateSnippet()

Generate an HTML snippet representation of an element. Useful for creating preview snippets or copying HTML structure.
Element
required
The DOM element to generate a snippet for
string
HTML string representation of the element
Example:

Constants

DEFAULT_THEME

The default theme configuration used by React Grab. Contains all theme properties with their default values. Example:

See Also