How to Pass Data Between Targets in Shopify POS UI Extension?

Hello everyone,
I’m working with Shopify POS UI Extension and struggling with passing data between targets. I’d like to know how to pass a variable or an object from one target to another within the same app.

For example, I have a state variable stateApp used in useEffect inside the pos.home.tile.render target:

useEffect(() => {
api.toast.show(State: ${stateApp});
}, [stateApp]);

Now, I want to pass stateApp to the pos.home.modal.render target, and if I update stateApp inside pos.home.modal.render, the value should also update in pos.home.tile.render, causing the useEffect to trigger again.

How can I synchronize this state variable across targets in Shopify POS UI Extension?

I could be wrong, but looking at it, different render targets seems to be run separately (in different sandbox/context etc), so I’m not sure if you can pass data between them.

A workaround will be save the data to the server and then get it again in other render target