createComponent(component, options, data, before, replacedComp) {
    if (!component) {
      return;
    }
    options = options || this.options;
    data = data || this.data;
    options.parent = this;
    options.parentVisible = this.visible;
    options.root = options?.root || this.root || this;
    options.localRoot = this.localRoot;
    options.skipInit = true;
    if (!(options.display === 'pdf' && this.builderMode)) {
      component.id = FormioUtils.getRandomComponentId();
    }
    const comp = Components.create(component, options, data, true);
    comp.init();
    if (component.internal) {
      return comp;
    }

    if (before) {
      const index = _.findIndex(this.components, { id: before.id });
      if (index !== -1) {
        this.components.splice(index, 0, comp);
      }
      else {
        this.components.push(comp);
      }
    }
    else if (replacedComp) {
      const index = _.findIndex(this.components, { id: replacedComp.id });
      if (index !== -1) {
        this.components[index] = comp;
      }
      else {
        this.components.push(comp);
      }
    }
    else {
      this.components.push(comp);
    }
    return comp;
  }
Create a new component and add it to the components array.
@param {import('@formio/core').Component} component - The component JSON schema to create.
@param {object} options - The options to create the component with.
@param {import('@formio/core').DataObject} data - The submission data object to house the data for this component.
@param {import('@formio/core').Component} [before] - The component before which to add this component.
@param {import('@formio/core').Component} [replacedComp] - The component to replace with this component.
@returns {any} - The created component instance.