how to write an onClick event in my react app to take array index in this code? I just want to get array index as a output
This is my array in JSON file.
{
"Women": [
{
"id" : 1,
"name" : "See All",
"children" : [""]
},
{
"id" : 2,
"name" : "Clothes",
"children" : [ "Coats & jackets" , "Suits & blazers" , "Skirts"]
},
{
"id" : 3,
"name" : "Shoes",
"children" : [ "Boots" , "Flats" , "Ankle boots"]
},
{
"id" : 4,
"name" : "Bags",
"children" : [ "Handbags" , "Backpacks" , "Clutches"]
},
{
"id" : 5,
"name" : "Accessories",
"children" : [ "Jewelry" , "Belts" , "Scarves & Shawls"]
},
{
"id" : 6,
"name" : "Beauty",
"children" : [ "Make Up" , "Face Care" , "Hand Care"]
}
]
}
This is my array import
const Women = AdminCatData.Women.map ((data) => {
return(
{
...data,
}
)
}
)