Skip to main content

ReactUtils

ReactUtils is a utility class for interacting with React internals. Instance is accessible through the BdApi. This is extremely useful for interacting with the internals of the UI.

Properties

Methods

getInternalInstance

Gets the internal React data of a specified node.

ParameterTypeDescription
nodeHTMLElementNode to get the internal React data from

Returns: object - Either the found data or undefined


getOwnerInstance

Attempts to find the "owner" node to the current node. This is generally a node with a stateNode - a class component.

ParameterTypeOptionalDefaultDescription
nodeHTMLElementnoneNode to obtain React instance of
optionsobjectnoneOptions for the search
options.includearraynoneList of items to include in the search
options.excludearray["Popout", "Tooltip", "Scroller", "BackgroundFlash"]List of items to exclude from the search.
options.filtercallable=>Filter to check the current instance with (should return a boolean)

Returns: object - The owner instance or undefined if not found


wrapElement

Creates an unrendered React component that wraps HTML elements.

ParameterTypeDescription
elementHTMLElementElement or array of elements to wrap

Returns: object - Unrendered React component