Receive modal data in React app

Hey guys!

I using modals as shown in thread React Example for Multiple location Apps & Modals. Now I’m trying to return data or just tell the component that the modal was closed:

modal:

client.instance.send({ message: {} });
client.instance.close();

app component:

client.instance.receive(()=>{console.log('ok')});

But it’s not working.
How can I accomplish that?