I have an array whose data I retrieve via the map()
method. How do I put the key
in the id
of the array record?
Here’s just the code:
const [Arr, setArr] = useState([{ id: null, value: "text" }]);
{Arr.map((item, i) => {
{item.value}
})}
And I want to put i
from the map()
method into the id
array Arr
.
How do I do it? Thanks!