React Redux: Sharing data between different components.

I’m developing Pwa using reactjs, Redux with Nodejs.

If two components are in the relationship of parent and child then it’s easy to share data between them.

But what to do if they don’t have any relationship.

I got this challenge while implementing login on login dependent components.

My requirement was to notify component named purchase as soon as login is successful from login component.

I got the solution to subscribe store.

So I subscribed to store on purchase function click and called login component.

As login set a property in store my subscribed function is called.

On getting the condition true, I called my purchase function and unsubsidised the store listening.

It notified me on login.

Please share your comments or any better approach.