I am trying to create a web application in which the users can drag buttons all over the place and maybe add buttons if they want. I am facing a problem which is:
How can I add to the store a key-value pair. My store looks like this:
const buttons = useStore(buttonsRouteLoader().value?.buttons || {}, {deep:true})
the store will look like this if there is data loaded into it:
{
"12" : {...},
"33": {...}
}
I want to add lets say a new button id with its value into the store. How can I do that?
At the moment, the solution is to hard-refresh the page after adding a button. This will destroy the old store and create a new one. And re-render every component from scratch. I am trying to avoid that as much as I can.
Thank you for your help. Appreciated!