I am trying to implement a property (real estate) chain
Each chain item should know which chain item is above/below it
A chain item can have its own sub-chain, and this in turn applies to its sub-chain items as well and so on
Visually like this
[
{
id: 1,
belowId:0
},
{
id: 0,
belowId:2,
aboveId:1,
subChain: [{ id:3, subChain: [{ id:4}] }]
},
{
id: 2,
aboveId:0
}
]
I tried this above structure but I started getting confused how to update nested items in state and ui