• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A CLI app for visualizing how React components are structured in a project.

React Component Hierarchy Viewer

npm license PRs Welcome Maintenance

This script uses a fork of pretty-tree to build and display a visual representation of your React component hierarchy in the console. (The fork simply allows for colors of tree nodes to be depth-based)

rch example

Usage

rch is created with the intent of being installed globally, to make it easy to use anywhere on your system. You can do this with

$ npm install -g react-component-hierarchy

Once it is installed, you can run it by passing in the path to the source of the root component to begin with and rch will look for and map all of your root component's child components:

$ rch

  Usage: rch [opts] <path/to/rootComponent>

  React component hierarchy viewer.

  Options:

    -h, --help              output usage information
    -V, --version           output the version number
    -m, --module-dir <dir>  Path to additional modules not included in node_modules e.g. src
    -c, --hide-containers   Hide redux container components
    -t, --hide-third-party  Hide third party components

Requirements

rch has the following requirements to understand your code:

  • Component source files may use either a default export or named exports
  • Components may be defined in any way (es6 React.Component class, functional stateless, or react.createClass)
  • Must use raw non-transpiled JS.
  • Must use JSX
  • Must use ES6 import/export
  • If you are using React Redux, your component must be wrapped and exported with React Redux's connect function, e.g:
import { connect } from 'react-redux';

const SomeComponent = ({ title }) => <div>{title}</div>;

export default connect(
  mapStateToProps,
  mapDispatchToProps
)(SomeComponentContainer);

Or you can use a separate file for your container component which is formatted approximately like this:

import { connect } from 'react-redux';

import SomeComponent from '../components/SomeComponent';

const SomeComponentContainer = connect(
  mapStateToProps,
  mapDispatchToProps
)(SomeComponent);

export default SomeComponentContainer;

(If your container components merely render their children with JSX, that works too.)


Website: blackpixel.com  ·  GitHub: @bpxl-labs  ·  Twitter: @blackpixel  ·  Medium: @bpxl-craft

More Repositories

1

IAPKit

A simple approach to Apple In App Purchases (IAP) that handles the presentation of products, purchasing, receipt validation, and timed free trials.
C
500
star
2

BPXLUUIDHandler

Objective-C
214
star
3

StatusBarLayer

A Framer module for generating accurate, customizable status bars for iOS app prototypes.
CoffeeScript
52
star
4

ControlPanelLayer

A Framer module for creating a developer panel to control aspects of the prototype from within the prototype.
CoffeeScript
34
star
5

RemoteLayer

A Framer module to generate an interactive Apple TV remote for tvOS app prototypes.
CoffeeScript
30
star
6

redux-generators

CLI tool for quickly and easily scaffolding Redux applications
JavaScript
29
star
7

FocusEngine

A Framer module for simulating the grid focus behavior found on Apple TV and Roku.
CoffeeScript
23
star
8

GradientHelper

A Framer module for applying gradients to layers and animating them.
CoffeeScript
21
star
9

MapboxLayer

A Framer module for creating powerful Mapbox maps in your prototypes.
CoffeeScript
20
star
10

CarouselComponent

A Framer module for creating a scrolling carousel of items in various configurations.
CoffeeScript
18
star
11

NavbarComponent

A Framer module for generating an iOS-style navigation bar.
CoffeeScript
16
star
12

redux-handbook

Black Pixel Redux Handbook
CSS
12
star
13

AutoDC

Automated data-centric processing
Python
10
star
14

BreakOut

BreakOut Demo for the iPad featured at the Seattle Voices That Matter Conference
C++
7
star
15

firefly

Shell
7
star
16

terraform-aws-s3-static-site

HCL
6
star
17

terraform-kubernetes-flux2-bootstrap

Boostrap a flux deployment on EKS
HCL
5
star
18

usoniancss

A CSS toolkit for building scalable, performant UI.
CSS
4
star
19

hue-gallery

A client-side web app that extracts an image’s color palette and sends it to the Philips Hue API. Featured in Net Magazine's December 2016 issue.
JavaScript
4
star
20

framer-module-boilerplate

Framer Module Boilerplate
CoffeeScript
3
star
21

payload-command-console

C++
3
star
22

hyperdrive

Python
2
star
23

redux-todomvc

Black Pixel's Redux Todomvc example. Architecture based on http://bpxl-labs.github.io/redux-handbook/
JavaScript
2
star
24

DebugInjectorSample

Securely add debug-only functionality to Android apps and test locale changes in debug builds.
Java
1
star
25

metal-lab

Getting the basic pipeline of metal figured out
Swift
1
star
26

bpxl-animation-samples

Examples illustrating iOS 10’s UIPropertyViewAnimator API.
Swift
1
star