score:0

Accepted answer
import React from "react";
import "./styles.css";

const Comp1 = () => <>Hello1</>;
const Comp2 = () => <>Hello2</>;
const Comp3 = () => <>Hello3</>;
const Comp4 = () => <>Hello4</>;

const Icons = {
  comp1: Comp1,
  comp2: Comp2,
  comp3: Comp3,
  comp4: Comp4
};

export default function App() {
  let iconKeys = Object.values(Icons);
  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <h2>Start editing to see some magic happen!</h2>
      {iconKeys.map((Comp) => (
        <li>
          <Comp />
        </li>
      ))}
    </div>
  );
}



Related Query

More Query from same tag