Display an array of objects in react

Hello, I want to render a cube with the length of an array and display it in the react canvas, but it is not possible
import React, {useState} from ‘react’
import {Canvas} from ‘@react-three/fiber’

function App() {

const [cub,setCub]=useState([2,5,6,7])

return (




export default App;

Here is an array of 5 cubes in R3F

 {[...Array(5).keys()].map((x) => (
  <mesh key={x} position={[x * 1.2, 0, 0]}>
    <boxGeometry />
    <meshNormalMaterial wireframe={true} />


And two slightly more advanced examples