import { useContext } from 'react';
import PropTypes from 'prop-types';
import { getTarget, targetPropType } from './Shared/helper.js';
import { Context } from './CPopperContent';

//component - CoreUI / CPopperTargetHelper

var CPopperTargetHelper = function CPopperTargetHelper(props) {

  var context = useContext(Context);

  //render

  context.popperManager.setTargetNode(getTarget(props.target));
  return null;
};

CPopperTargetHelper.propTypes = {
  target: targetPropType.isRequired
};

export default CPopperTargetHelper;