van icon indicating copy to clipboard operation
van copied to clipboard

Deeply nested state objects and arrays

Open DanielMazurkiewicz opened this issue 1 year ago • 1 comments
trafficstars

Looking into a code and trying to wrap my head around a topic of dynamic deeply nested object and array structures. I'm pretty sure someone here thought it through and I don't have to rediscover things.

Lets say I have this example:

const items = vanX.reactive([])
return vanX.list(ul, items, v => SomeComponent(v))

and then I add item:

items.push({
    type: "some_sub_items",
    sub_items: []
})

can I use vanX.list on sub_items?

DanielMazurkiewicz avatar Dec 14 '23 08:12 DanielMazurkiewicz

Yes. I think that should be possible. You might need to manually cast the nested field into a Reactive object in order to use vanX.list.

Tao-VanJS avatar Dec 14 '23 16:12 Tao-VanJS