I want to create an array with random values filled in it between 0 to 7 and use this array as state value but use it in for loop of functional component call for loop multiple times when console.log state value. This will create rendering error in react
import React from "react";
import "./style.css";
import { usestate} from "react"
export default function App() {
const [ state , setstate ] = usestate([]);
let arr = [] ;
for(let i = 0 ; i < 64 ; i++){
arr[i] = Math.floor((Math.random ()*8));
}
setstate(arr);
return (
<div>
<h1>State</h1>
<p>{state}</p>
</div>
);
}
Thank you