Necesito representar un componente jsx para cada elemento en una matriz.
import { ListView } from './components'; // Custom component const array = ["item1","item2","item3"]; export default function App() { return( <div> {/* Here i want to render a <ListView /> component for each of the items in the array. */} </div> ); }Aquí hay 3 elementos en la matriz, así que quiero representar 3 componentes diferentes.
Cualquier ayuda será apreciada.
Trate de usar el método de mapa:
return ( <div>{ array.map(item => <ListView key={item} item={item} /> }</div> )