src/reactParser.js
function getChildJSXElements(node, parent) {
  if (node.children.length === 0) return [];
  const childJsxComponentsArr = node
    .children
    .filter(jsx => jsx.type === 'JSXElement'
      && htmlElements.indexOf(jsx.openingElement.name.name) < 0);
  return childJsxComponentsArr
    .map(child => {
      return {
        name: child.openingElement.name.name,
        children: getChildJSXElements(child, parent),
        props: getReactProps(child, parent),
        state: {},
        methods: [],
      };
    });
}
function getChildJSXElements(node, parent) {
  if (node.children.length === 0) return [];
  const childJsxComponentsArr = node
    .children
    .filter(jsx => jsx.type === 'JSXElement'
      && htmlElements.indexOf(jsx.openingElement.name.name) < 0);
  return childJsxComponentsArr
    .map(child => {
      return {
        name: child.openingElement.name.name,
        children: getChildJSXElements(child, parent),
        props: getReactProps(child, parent),
        state: {},
        methods: [],
      };
    });
}
function getChildJSXElements ( node , parent ) { if ( node . children . length === 0 ) return [ ] ; const childJsxComponentsArr = node . children . filter ( jsx => jsx . type === 'JSXElement' && htmlElements . indexOf ( jsx . openingElement . name . name ) < 0 ) ; return childJsxComponentsArr . map ( child => { return { name : child . openingElement . name . name , children : getChildJSXElements ( child , parent ) , props : getReactProps ( child , parent ) , state : { } , methods : [ ] , } ; } ) ; }
Returns array of children components of React component passed to input
@param {Node} node
@returns {Array} Array of (nested) children of React component passed in
Returns array of children components of React component passed to input