I have the following object:
obj = {
title: "obj1",
tab: [{
title: "titulo da tab 1",
card: [{
title: "card1",
url: "url",
image: "image"
},
{
title: "card2",
url: "url",
image: "image"
}]
},
{
title: "titulo da tab 2",
card: [{
title: "card3",
url: "url",
image: "image"
},
{
title: "card4",
url: "url",
image: "image"
}]
}
]
}
When I want to change the state of a variable in react use
setState({obj1: data})
When I want to change the state of a property of an obj I use:
setState({obj1: {...this.state.obj1, title: "new title"} })
But my difficulty is:
- How to change the title of a card in the obj?
- How to change a tab title in obj?