I have a deeply nested redux state that looks like this:
{
name: "Item One",
children: [
{
name: "Item Two"
children: [
....
]
},
{
name: "Item Three",
children: [
....
]
}
]
}
I need to make it's copy, so that I could conveniently modify it, and then replace the state with it.
Unfortunately just using {...state} doesn't work, because all the nested children are not being copied, they still refer to the same objects. Is there a convenient workaround for this?