
Description
react-inspector brings the power of browser DevTools inspectors into a React app. It is an npm package with three main components. ObjectInspector works like console.log, showing a tree of any JavaScript object that you can expand and collapse, and its state is kept at the root so an expanded branch stays open after the element is unmounted. TableInspector works like console.table. DOMInspector shows a DOM node in the same way, and the shorthand Inspector component chooses between them based on what it is given. ObjectInspector takes props such as data, a root name, expandLevel to open the tree to a set depth, and expandPaths, which uses a JSONPath-like string to open chosen branches. It can show non-enumerable properties, sort keys alphabetically, and take a custom nodeRenderer. The README recommends version 3.0.2 for React 16.8.4 and later, and version 2.3.1 for earlier React versions. The project has a Storybook demo. It suits developers who want to inspect data while building or debugging a React interface.…
Highlights
- Object tree like console.log
- Table view like console.table
- DOM node inspector
- Expand levels and expand paths
Ratings & Reviews
No ratings yet
Be the first to rate react-inspector.
People also visit
react-inspector FAQ
What does react-inspector do?
It shows JavaScript objects, tables and DOM nodes inside a React app as expandable inspectors, similar to browser DevTools.
How do I install it?
Install it from npm. The README recommends version 3.0.2 for React 16.8.4 or later, and version 2.3.1 for earlier React versions.
How do I open part of the tree at once?
Use expandLevel for a set depth, or expandPaths with paths such as $.foo.bar to open chosen branches.
Can I sort the keys?
Yes. sortObjectKeys sorts object keys alphabetically, except for arrays.
Is there a demo?
The README points to a Storybook demo.
What are the best react-inspector alternatives?
Popular alternatives to react-inspector include react18-json-view, searchable-react-json-view and react-json-viewer-cool. See all react-inspector alternatives















