[
{
"id": 339,
"children": [
{
"id": 381,
"children": [
{
"id": 383,
"children": [],
"name": "Capability_C",
"level": 3,
}
],
"name": "Capability_B",
"level": 2,
}
],
"name": "Capability_A",
"level": 1,
}
]
How do i correctly update this nested object within my reducer (the state has a list of these objects, while a payload has a specific object that can be a nested object
return [...state, payload];