traverseAllChildren = (component, parentArr) => {
  if (!component._currentElement) return;

  const newComponent = {
    children: [],
    id: null,
    idDOM: false,
    name: 'default',
    state: null,
    props: null,
    ref: null,
    key: null,
  };

  __ReactSightStore = getStore(component);

  newComponent.state = getState(component);
  newComponent.key = getKey(component);
  newComponent.ref = getRef(component);
  newComponent.name = getName(component);
  newComponent.props = getProps(component);

  const id = getId(component);
  newComponent.id = id.id;
  newComponent.isDOM = id.isDOM;

  // Add new component to parent's array
  parentArr.push(newComponent);

  const { _renderedChildren, _renderedComponent } = component;

  // traverse child or children of current component
  if (_renderedComponent) traverseAllChildren(_renderedComponent, newComponent.children);
  else if (_renderedChildren) {
    const keys = Object.keys(_renderedChildren);
    keys.forEach(key => traverseAllChildren(_renderedChildren[key], newComponent.children));
  }
}
Recursively walk through virtual DOM and build up JSON representation

@param {react component} component - a react component
@param {array} parentArr - array representing component's parent