Convert Figma logo to code with AI

React-Sight logoReact-Sight

Visualization tool for React, with support for Fiber, Router (v4), and Redux

2,868
119
2,868
50

Top Related Projects

86,480

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation

An extension that allows inspection of React component hierarchy in the Chrome and Firefox Developer Tools.

A Cross-Browser, Event-based, Element Resize Detection for React

A flexible playground for live editing React components

DevTools for Redux with hot reloading, action replay, and customizable UI

Quick Overview

React-Sight is a Chrome DevTools extension for visualizing React component hierarchies. It provides a tree view of the component structure, state, and props, making it easier for developers to debug and understand their React applications.

Pros

  • Offers a clear visual representation of React component hierarchies
  • Provides real-time updates as the application state changes
  • Integrates seamlessly with Chrome DevTools
  • Supports React Fiber and React Router

Cons

  • Limited to Chrome browser only
  • May not work correctly with all React versions or complex setups
  • Can potentially slow down performance in large applications
  • Requires manual installation and setup

Code Examples

As React-Sight is a browser extension and not a code library, there are no code examples to provide.

Getting Started

To get started with React-Sight:

  1. Visit the Chrome Web Store and search for "React-Sight"
  2. Click "Add to Chrome" to install the extension
  3. Open Chrome DevTools in your React application
  4. Navigate to the "React-Sight" tab
  5. The component hierarchy will be displayed as an interactive tree

Note: Ensure that your React application is running in development mode for React-Sight to work properly.

Competitor Comparisons

86,480

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation

Pros of Storybook

  • Comprehensive UI development environment with extensive documentation and community support
  • Supports multiple frontend frameworks beyond React, including Vue, Angular, and Svelte
  • Offers advanced features like addons, theming, and integration with design tools

Cons of Storybook

  • Steeper learning curve due to its extensive feature set
  • Can be overkill for smaller projects or teams
  • Requires additional setup and configuration compared to simpler visualization tools

Code Comparison

React-Sight:

chrome.devtools.panels.create('React-Sight', null, 'devtools.html', () => {
  console.log('React-Sight panel created');
});

Storybook:

import { configure } from '@storybook/react';

function loadStories() {
  require('../stories/index.js');
}

configure(loadStories, module);

Summary

Storybook is a more comprehensive tool for UI development and component documentation, offering support for multiple frameworks and advanced features. React-Sight, on the other hand, focuses specifically on React component visualization within Chrome DevTools. While Storybook provides a richer development environment, it may be more complex to set up and use compared to React-Sight's simpler approach.

An extension that allows inspection of React component hierarchy in the Chrome and Firefox Developer Tools.

Pros of React DevTools

  • Official tool developed and maintained by Facebook, ensuring compatibility and regular updates
  • Integrated seamlessly with browser developer tools for a familiar debugging experience
  • Offers advanced features like component filtering, props inspection, and performance profiling

Cons of React DevTools

  • Limited visualization capabilities for complex component hierarchies
  • May require additional setup for certain project configurations or environments
  • Can be overwhelming for beginners due to its extensive feature set

Code Comparison

React DevTools:

const MyComponent = () => {
  const [count, setCount] = useState(0);
  return <div onClick={() => setCount(count + 1)}>{count}</div>;
};

React-Sight:

// No specific code example available, as React-Sight focuses on
// visualization rather than code modification or inspection

React DevTools provides a more comprehensive set of debugging tools and integrates directly with browser developer tools, making it a powerful choice for React developers. However, React-Sight offers a unique visual representation of component hierarchies, which can be beneficial for understanding complex application structures. While React DevTools is more feature-rich and widely adopted, React-Sight may be preferred by developers who prioritize visual component tree representations.

A Cross-Browser, Event-based, Element Resize Detection for React

Pros of react-resize-detector

  • Focused specifically on detecting element resizing, providing a more specialized solution
  • Lightweight and easy to integrate into existing React projects
  • Supports both hooks and class component implementations

Cons of react-resize-detector

  • Limited to resize detection functionality, lacking broader React component visualization
  • May require additional setup for complex resize scenarios
  • Less comprehensive documentation compared to React-Sight

Code Comparison

React-Sight:

import React from 'react';
import { render } from 'react-dom';
import App from './components/App';

render(<App />, document.getElementById('root'));

react-resize-detector:

import React from 'react';
import { useResizeDetector } from 'react-resize-detector';

const MyComponent = () => {
  const { width, height, ref } = useResizeDetector();
  return <div ref={ref}>Width: {width}, Height: {height}</div>;
};

React-Sight focuses on providing a comprehensive visualization tool for React component hierarchies, while react-resize-detector specializes in detecting element resizing. React-Sight offers a broader scope for debugging and understanding React applications, whereas react-resize-detector provides a specific solution for handling resize events in React components. The code comparison illustrates the difference in implementation, with React-Sight focusing on rendering the entire application and react-resize-detector demonstrating its resize detection functionality within a single component.

A flexible playground for live editing React components

Pros of react-live

  • Provides a live, interactive coding environment for React components
  • Supports real-time code editing and preview
  • Offers customizable theming options for the editor

Cons of react-live

  • Limited to React-specific code evaluation
  • Requires additional setup for more complex scenarios
  • May have performance issues with large or complex components

Code Comparison

React-Sight:

chrome.devtools.panels.create(
  'React-Sight',
  null,
  'panel.html',
  function() { /*...*/ }
);

react-live:

<LiveProvider code={code}>
  <LiveEditor />
  <LiveError />
  <LivePreview />
</LiveProvider>

Summary

React-Sight is a Chrome DevTools extension for visualizing React component hierarchies, while react-live is a library for creating live, editable React environments. React-Sight focuses on debugging and understanding existing React applications, whereas react-live is geared towards creating interactive coding experiences and documentation. Both tools serve different purposes within the React ecosystem, with React-Sight being more suited for development and debugging, and react-live being ideal for educational and demonstration purposes.

DevTools for Redux with hot reloading, action replay, and customizable UI

Pros of Redux DevTools

  • Specifically designed for Redux state management, offering deep integration and detailed state tracking
  • Provides time-travel debugging, allowing developers to move back and forth through state changes
  • Supports middleware and enhancers, enabling advanced debugging capabilities

Cons of Redux DevTools

  • Limited to Redux-based applications, not suitable for other state management solutions
  • Can be overwhelming for beginners due to its extensive feature set
  • Requires additional setup and configuration compared to simpler visualization tools

Code Comparison

Redux DevTools:

import { createStore, applyMiddleware, compose } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';

const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(...middleware))
);

React-Sight:

// No specific code integration required
// React-Sight works as a browser extension

React-Sight offers a more straightforward setup as a browser extension, while Redux DevTools requires integration into the Redux store creation process. Redux DevTools provides more detailed state management insights, but React-Sight offers a broader view of the component hierarchy and props flow, making it useful for general React application debugging.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Coverage Status Maintainability Build Status Chrome Web Store Chrome Web Store Mozilla Add-on License: MIT

Note: project isn't actively maintained. If you would like to maintain, feel free to submit PRs or reach out to @davidcsally I also suggest installing it as click-to-run or inside its own chrome profile, so that it doesn't slow down regular browsing

React Sight


React Sight is a live view of the component hierarchy tree of your React application with support for React Router and Redux. Now with support for Firefox!



Set Up | Install From the Chrome Store

  1. Make sure you've added React Dev Tools to Chrome.
  2. Install React Sight from the Chrome web store
  3. If you are running local file URLs, make sure to enable "Allow access to file URLs" in the extension settings for both React Dev Tools and React Sight
  4. Run your React application, or open (almost!) any website running React!
  5. Open Chrome Developer Tools (cmd+opt+j) -> React Sight panel

Set Up | Firefox

This is the same as Chrome, except you will use the addons from the Firefox website

  1. Add React Dev Tools
  2. Add React Sight from the Firefox addons website.

Building Your Own Version

If you'd like to build your own version of React Sight from the source code, follow these steps:

  1. Clone the repo and run yarn install or npm install to install dependencies.
  2. Use yarn build to generate the build.

Adding to Chrome

  1. Open Chrome and go to the extensions page
  2. Toggle developer mode in the upper right corner if necessary
  3. Click 'Load unpacked'
  4. Load the folder ~/ReactSight/build/extension

Firefox

  1. Load the extension as a "Temporary Extension" by navigating to: about:debugging#/runtime/this-firefox
  2. Click "Load Temporary Add-on"
  3. Load the file ~/ReactSight/build/extension/manifest.json. In Firefox, you load the extension's manifest instead of the extension's folder

If you have any additional questions send us a message at reactsight@gmail.com :)

Usage

Hover over nodes to see their state and props in the side panel.

Hide DOM elements, Redux components, and Router components with the built in filters, so that you can focus only on the components you've written

Zoom in by double clicking, and zoom out by shift + double clicking (mousewheel zoom coming soon!)

Why?

We built React Sight because there are no tools on the market that give you a visual representation of the structure of your App. When we were developing our own projects, we wished we had a way to see how everything was structured.

We wanted React Sight to be simple to use, which is why all you have to do is install a Chrome extension. No modifying your existing code!

How Does It Work?

When the dev tools are opened, React-Sight searches for React renderer's, and patches the render to collect data on each state change.

Data is posted to the Window, where it is read by Chrome's background.js window, and is then relayed to React-Sight's devTools page.

The raw data is then processed and fed to D3, where it is displayed to the user.

Troubleshooting

In React16 you will need to trigger a render to have your application show up. The data is not exposed until React's renderer is called.

'React not found' or no data:

Sometimes React-Sight doesn't get a snapshot of the data at load, triggering a setState ussually fixes this

Maximum call stack exceeded and other console errors:

This is a bug where the parsing functions get stuck in an infinite loop. We are working on a fix.

Testing

Run yarn test to run the test suite. Tests are run using jest.

Contributing

Found a bug? Have a suggestion? Want to make React-Sight better?

Please submit issues/pull requests if you have feedback or would like to contribute. If you're interested in joining the React Sight team as a contributor, feel free to message one of us directly, or just start submitting pull requests!

Authors

David C Sally (https://github.com/davidcsally)

Grant Kang (https://github.com/Grant05)

William He (https://github.com/hewilliam)

Contact

Like our app? Found a bug?

Tell us what you think!

reactsight@gmail.com

Visit us at www.reactsight.com

Roadmap

Here's our top development priorities

  1. Better support across on React 16+.
  2. More consistent detection of root nodes when React Sight is opened.
  3. Support for multiple React Applications / mounting nodes, currently it picks the first React application in the renderers list.
  4. More robust error handling and guard blocks for extracting state, props, and store
  5. Logging / Debugging mode for development, feedback, and error reporting
  6. Performance and stability updates
  7. UX improvements
  8. Improved documentation
  9. Hook into the react-devtools-backend so that we don't have to reimplement it :)

License

This project is licensed under the MIT License - see the LICENSE.md file for details

NPM DownloadsLast 30 Days