ui/RenderingEngine.js
function _create (state, vel) {
  let comp = vel._comp
  console.assert(!comp, 'Component instance should not exist when this method is used.')
  let parent = vel.parent._comp
  // making sure the parent components have been instantiated
  if (!parent) {
    parent = _create(state, vel.parent)
  }
  // TODO: probably we should do something with forwarded/forwarding components here?
  if (vel._isVirtualComponent) {
    console.assert(parent, 'A Component should have a parent.')
    comp = state.componentFactory.createComponent(vel.ComponentClass, parent, vel.props)
    // HACK: making sure that we have the right props
    // TODO: instead of HACK add an assertion, and make otherwise sure that vel.props is set correctly
    vel.props = comp.props
    if (vel._forwardedEl) {
      let forwardedEl = vel._forwardedEl
      let forwardedComp = state.componentFactory.createComponent(forwardedEl.ComponentClass, comp, forwardedEl.props)
      // HACK same as before
      forwardedEl.props = forwardedComp.props
      comp._forwardedComp = forwardedComp
    }
  } else if (vel._isVirtualHTMLElement) {
    comp = state.componentFactory.createElementComponent(parent, vel)
  } else if (vel._isVirtualTextNode) {
    comp = state.componentFactory.createTextNodeComponent(parent, vel)
  }
  if (vel._ref) {
    comp._ref = vel._ref
  }
  if (vel._owner) {
    comp._owner = vel._owner._comp
  }
  vel._comp = comp
  return comp
}
function _create (state, vel) {
  let comp = vel._comp
  console.assert(!comp, 'Component instance should not exist when this method is used.')
  let parent = vel.parent._comp
  // making sure the parent components have been instantiated
  if (!parent) {
    parent = _create(state, vel.parent)
  }
  // TODO: probably we should do something with forwarded/forwarding components here?
  if (vel._isVirtualComponent) {
    console.assert(parent, 'A Component should have a parent.')
    comp = state.componentFactory.createComponent(vel.ComponentClass, parent, vel.props)
    // HACK: making sure that we have the right props
    // TODO: instead of HACK add an assertion, and make otherwise sure that vel.props is set correctly
    vel.props = comp.props
    if (vel._forwardedEl) {
      let forwardedEl = vel._forwardedEl
      let forwardedComp = state.componentFactory.createComponent(forwardedEl.ComponentClass, comp, forwardedEl.props)
      // HACK same as before
      forwardedEl.props = forwardedComp.props
      comp._forwardedComp = forwardedComp
    }
  } else if (vel._isVirtualHTMLElement) {
    comp = state.componentFactory.createElementComponent(parent, vel)
  } else if (vel._isVirtualTextNode) {
    comp = state.componentFactory.createTextNodeComponent(parent, vel)
  }
  if (vel._ref) {
    comp._ref = vel._ref
  }
  if (vel._owner) {
    comp._owner = vel._owner._comp
  }
  vel._comp = comp
  return comp
}
function _create ( state , vel ) { let comp = vel . _comp console . assert ( ! comp , 'Component instance should not exist when this method is used.' ) let parent = vel . parent . _comp // making sure the parent components have been instantiated if ( ! parent ) { parent = _create ( state , vel . parent ) } // TODO: probably we should do something with forwarded/forwarding components here? if ( vel . _isVirtualComponent ) { console . assert ( parent , 'A Component should have a parent.' ) comp = state . componentFactory . createComponent ( vel . ComponentClass , parent , vel . props ) // HACK: making sure that we have the right props // TODO: instead of HACK add an assertion, and make otherwise sure that vel.props is set correctly vel . props = comp . props if ( vel . _forwardedEl ) { let forwardedEl = vel . _forwardedEl let forwardedComp = state . componentFactory . createComponent ( forwardedEl . ComponentClass , comp , forwardedEl . props ) // HACK same as before forwardedEl . props = forwardedComp . props comp . _forwardedComp = forwardedComp } } else if ( vel . _isVirtualHTMLElement ) { comp = state . componentFactory . createElementComponent ( parent , vel ) } else if ( vel . _isVirtualTextNode ) { comp = state . componentFactory . createTextNodeComponent ( parent , vel ) } if ( vel . _ref ) { comp . _ref = vel . _ref } if ( vel . _owner ) { comp . _owner = vel . _owner . _comp } vel . _comp = comp return comp }
called to initialize a captured component, i.e. creating a Component instance from a VirtualElement
called to initialize a captured component i . e . creating a Component instance from a VirtualElement