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 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 from 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: * - the owner instance or undefined if not found.


wrapElement

Creates an unrendered react component that wraps dom elements.

ParameterTypeDescription
elementHTMLElementelement or array of elements to wrap into a react component

Returns: object - - unrendered react component