Onboarding a dense React codebase? ReacTree has your back!

Brian Noh
5 min readFeb 23, 2023

--

The only VS Code extension with a dynamic and interactive hierarchy visualizer for React applications

ReacTree Logo

React is a widely used JavaScript library for building user interfaces, but working with large and complex codebases can be challenging, especially for new team members. To help streamline the onboarding process, my team and I have created ReacTree, a VS Code extension that generates a hierarchy tree of React components with each node listing the passed down props and indicating whether it’s connected to the Redux store. In this article, we’ll take a closer look at the features of this extension and how it can benefit React developers.

Generating the Component Hierarchy Tree

When using ReacTree, users can select any file to serve as the root file, allowing them to generate a hierarchy tree of components that’s tailored to their specific needs. The extension generates a comprehensive hierarchy tree that displays all components used in the application, including their parent-child relationships. This makes it simple for developers to visualize the structure of the codebase and comprehend how different components interact with each other. Additionally, the tree includes information about each component’s props, making it easier to understand how data is passed between components.

Navigating to Associated Files

One core feature of this extension is the ability for users to be led to the associated file of each component with the click of a button. This saves developers time and effort by eliminating the need to manually search for the corresponding file. The extension accomplishes this by displaying the path to the component’s file in the hierarchy tree and providing a button that, when clicked, opens the file in the editor.

Generate tree and navigate to file gif

Indicating Connections to the Redux Store

For developers using Redux for state management, the extension also indicates whether each component is connected to the Redux store. This can help developers quickly identify which components rely on shared state and how they interact with the store.

Connection to Redux Store

Reusable React Components

Components are the building blocks of React applications. One of the key features of React is its ability to create reusable components. ReacTree also shows how many times each component is being reused throughout the codebase. This information can help developers identify commonly used components and better understand how they fit into the overall structure of the application.

Number of times a component is reused

Dynamic Tree Manipulation

The hierarchy tree is dynamic, allowing users to drag and move components around to better visualize the structure of the codebase. This feature can be particularly useful for identifying areas of the codebase that could be refactored or optimized.

dynamic tree manipulation gif

UI/UX

Do you love customizing your VS Code theme to match your mood or project? Well, we have something that will take your customization game to the next level! Introducing our dynamic tree feature that changes color according to your VS Code theme. Yes, you heard that right! Every time you switch your theme, your tree will transform to match your new look. Imagine the excitement of having a seamless and immersive coding experience, where every element on your screen adapts to your personal style. Our dynamic tree feature brings a new level of engagement to your coding journey, making it easier and more enjoyable to navigate through your project.

Technical Challenges

VS Code extensions can contribute custom view containers to the activity bar, primary sidebar or to the panel. ReacTree was built using the Visual Studio Code Extension API and the Visual Studio Code Panel API. The Extension API provides developers with the tools necessary to create extensions that add functionality to the VS Code editor. The Panel API, on the other hand, allows for the creation of custom panels within the editor that can display information or user interfaces.

One of the biggest challenges we faced was the lack of documentation available on how to build a VS Code extension that uses React to create a custom panel. This required us to do a significant amount of research and experimentation to figure out the best approach.

One of our engineers, Michael Mike Benliyan, has written a Medium article that goes into detail about the technical details and set up for building a VS Code extension with a React panel view. You can check out that article here.

In conclusion, ReacTree is a dynamic VS Code extension that provides a powerful tool for React developers to streamline the onboarding process and become familiar with complex codebases quickly. By generating a tailored hierarchy tree of components with the passed down props, enabling users to navigate to associated files, indicating connections to the Redux store, showing the number of times a component is being reused, allowing for dynamic tree manipulation, this extension provides developers with a visual representation of the codebase that can help them better understand its structure and functionality.

Contribution and Support

ReacTree is an open source project that was developed under the tech accelerator Open Source Labs. If you are interested in contributing to the project, have suggestions for improvements or new features, or simply want to show your support, there are several ways to get involved.

To install the ReacTree extension for Visual Studio Code, click here to simply navigate to the following link to the VS Code marketplace. You can also check out more information and get started with ReacTree on the official webpage and on its LinkedIn page. These pages provide useful information about the project, including how it works, its key features, and how to get started with using it.

Additionally, if you would like to contribute to the project, you can visit the GitHub repository. There you can find the project’s source code, documentation, and issue tracker. You can also fork the project, make changes, and submit pull requests to help improve the project.

If you like the project and find it useful, please consider giving it a star on GitHub. This can help increase visibility for the project and attract more contributors and users.

ReacTree Engineering Team

Brian Noh | LinkedIn | Github

Fabian Salazar | LinkedIn | Github

Mike Benliyan | LinkedIn | Github

Kevin Liu | LinkedIn | Github

Justin Kim | LinkedIn | Github

--

--

Brian Noh
Brian Noh

Written by Brian Noh

Hello, I'm a Software Engineer with experience in building full stack scalable applications. Always open to chat and learn/grow as a developer.

Responses (3)