I have an array with objects with nested arrays that looks like this:
var category_tree = [
    {
        category_id: 1,
        name: "A",
        children: [
            {
                category_id: 2,
                name:" B, child of A",
                children: [
                    {
                        category_id: 3,
                        name: "C, child of B",
                    }
                ]
            }
        ]
    }
]
I want to take another object that looks like this:
{ 
    categories: []
    isFetching: false, 
    isValid: false, 
    currentFilter: "NAME_ASCENDING", 
    displayError: false, 
    errorMessage: ""
}
And set the categories attribute equal to this category_tree object.
Unfortunately no matter what I try, I lose everything from the children key down:
{ 
    categories: [{
        category_id: 1,
        name: "A",
        children: []
    }],
    isFetching: false, 
    isValid: false, 
    currentFilter: "NAME_ASCENDING", 
    displayError: false, 
    errorMessage: ""
}
So that's my question: how do I assign a nested array/object as the attribute of an object?
Edit: What I have tried:
let newState = Object.assign({}, state, {                                                 
        isFetching: false,                                                                    
        valid: true,   
        categories: category_tree                                                   
    })
let newState = Object.assign({}, state, {
    isFetching: false,
    valid: true
})
newState.categories = category_tree
Desired result:
{ 
    categories: [
        {
            category_id: 1,
            name: "A",
            children: [
                {
                    category_id: 2,
                    name:" B, child of A",
                    children: [
                        {
                            category_id: 3,
                            name: "C, child of B",
                        }
                    ]
                }
            ]
        }
    ],
    isFetching: false, 
    isValid: false, 
    currentFilter: "NAME_ASCENDING", 
    displayError: false, 
    errorMessage: ""
}
 
    