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?