RE: Inter portlet communication with react js

Pothapu Jagadeswara Reddy, modified 6 Years ago. New Member Posts: 4 Join Date: 7/23/19 Recent Posts
Hi All,

I am using Liferay 7.2 version. I have a requirement like develop portlets with react js and those portlets internally need to communicate. Request you to help me please!!!For example, I created portlets with react js. Those portlets are like HTML form, text input, button etc. Now these portlets should have inter portlet communication based on events.
​​​​​​​Appreciate your help!!!
thumbnail
Ivan Zaera, modified 6 Years ago. Regular Member Posts: 119 Join Date: 10/1/13 Recent Posts
I guess there are infinite ways to achieve that, but you can see an example where inter portlet communication is done using Redux here -> https://github.com/izaera/liferay-js-toolkit-showcase/tree/react

I'm not saying that's the best way, but just a possible one out of the many.

Hope that helps.
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
I did a blog post for Angular 2 here: https://liferay.dev/blogs/-/blogs/angular-2-portlets-in-dxp

Although you're using React, the same Liferay.on() and Liferay.fire() methods are still available to you.

​​​​​​​And the plus side is that the mechanism is not tied to a specific portlet implementation, as long as you can access the Liferay JS objects, you can use this to communicate.