I have the following code in my React:
{
comments.map((comment, index) =>
console.log({index}),
<Textfield key = {index} placeholder = "Add Comment" Id = "addComment" / >
)
}
However, this returns me error that 'index' is not defined no-undef on the console.log line. This is the state:
const [comments,setComments] = useState([[]])
Why does this happen?