Reducer split problem

there are multiple levels of tab and step, in state. It is very painful to modify a deeper level of state. How to split reducer?? Or how to flatten the reducer?

var tabs = [
    {
        id:1,
        children:[
            {
                id:11,
                steps:[
                    {
                        form:[
                            {
                                name:"foo",
                                type:"input"
                            }
                        ]
                    },{},{}...
                ]
            },
            {
                id:12,
                steps:[{},{}]
            }
        ]
    },
    {
        id:2,
        children:[]
    },
    ...
]

for example, if I want to change the Foo value in state above, I need to find tabs [0] .children [0] .values [0] .form[ xx] .foo = "boo" , which will be very painful. How can it be simplified?

Jun.18,2021

although the level is relatively deep, it is not necessary to split every level, that is, not every layer needs the relevant business processing code. If not, it is not necessary to split, only the necessary levels.

Menu