[resolved] how react generates components from strings

for example, I want to generate components from a circular array:

import React, { Component } from "react";
import { Button, Input } from "antd";

const arr = ["Button", "Input"]; // <Button /> <Input />

export default class MyComp extends Component {
  renderComp = arr => {
    return arr.map(V => {
      return React.createElement(this.transform(V), null, null)
      // 
      //  <V />  React.createElement(V, null, null) <Button />  <Input />
    }) 
  }

  transform = str => {
  switch(str){
    case "Button":
    return Button;
    case "Input":
    return Input;
    default:
    return null;
  }
  }

  render(){
  return(
    <div>
    {this.renderComp(arr)}
    </div>
  )
  };
}

what should I do?
have also tried new Function, dangerouslySetInnerHTML and eval
, all of which cannot be implemented =-=

Mar.10,2021


renderComp = arr => {
    return arr.map(V => {
      return React.createElement(this.transform(V), null, null)
      // 
      //  <V />  React.createElement(V, null, null) <Button />  <Input />
    }) 
  }

A return is missing

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d03a-2bad9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d03a-2bad9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?