packages/okidoc-site/site/src/utils/renderHtmlAst.js
function renderHtmlAst(node, { components }) {
  if (node.type === 'root') {
    // NOTE: wrap children with React.Fragment, to avoid div wrapper from `hast-to-hyperscript`
    node = {
      type: 'element',
      tagName: Fragment,
      properties: {},
      children: node.children,
    };
  }

  function h(name, props, children) {
    return React.createElement(
      getReactElement(name, components),
      props,
      getReactChildren(name, children),
    );
  }

  return toH(h, node);
}
function renderHtmlAst(node, { components }) {
  if (node.type === 'root') {
    // NOTE: wrap children with React.Fragment, to avoid div wrapper from `hast-to-hyperscript`
    node = {
      type: 'element',
      tagName: Fragment,
      properties: {},
      children: node.children,
    };
  }

  function h(name, props, children) {
    return React.createElement(
      getReactElement(name, components),
      props,
      getReactChildren(name, children),
    );
  }

  return toH(h, node);
}
function renderHtmlAst ( node , { components } ) { if ( node . type === 'root' ) { // NOTE: wrap children with React.Fragment, to avoid div wrapper from `hast-to-hyperscript` node = { type : 'element' , tagName : Fragment , properties : { } , children : node . children , } ; } function h ( name , props , children ) { return React . createElement ( getReactElement ( name , components ) , props , getReactChildren ( name , children ) , ) ; } return toH ( h , node ) ; }
Compile HAST to React.
@param node
@param components
Compile HAST to React .