react-dom-walker icon indicating copy to clipboard operation
react-dom-walker copied to clipboard

Find render roots, reverse engineer and walk the React node tree.

react-dom-walker

Find render roots, reverse engineer and walk the React node tree.

Install

npm i react-dom-walker

Usage

import { walk, findRoots, getDisplayName } from 'react-dom-walker';

const displayNames = [];

for (const root of findRoots(document.body)) {
  walk(root, node => {
    displayNames.push(getDisplayName(node));
  });
}

// ['ComponentA', 'ComponentB']
console.log(displayNames);