I'm getting an error while rendering the following component:
Too many re-renders. React limits the number of renders to prevent an infinite loop.?
import React, { useState } from 'react';
function My() {
const [NAME, setValue_] = useState([{name:"",lname:""}]); // usestate
let arr = [{ name: "man", lname: "Kumar" }]; //.......creating array for passing to set the value for State..
setValue_(arr); //............passing array to Update data......
console.log(NAME); //..........Want to see updated Data....
return(<> </>) //............... i didn't return anything........
}