van
van copied to clipboard
Deeply nested state objects and arrays
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?
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.