Message Boards

Can I use React into Liferay?

Dejan Obradovic, modified 3 Years ago.

Can I use React into Liferay?

New Member Posts: 17 Join Date: 1/12/21 Recent Posts
Can I do everything with React framework without it interfering with the work of Liferay? Main reason for this is because I don't know Java language, so can I make custom things in React and use it normally with all Liferay features? Main reason is there is plenty of ready-made solutions in Liferay that I like it.
thumbnail
Olaf Kock, modified 3 Years ago.

RE: Can I use React into Liferay? (Answer)

Liferay Legend Posts: 6400 Join Date: 9/23/08 Recent Posts

There's a contradiction in the question: If you can do everything with react, you can certainly do something that interferes with Liferay. That being said, if you're aware of some specialties (like: You're potentially sharing the page with different applications, potentially even the exact same application) you should be good.

As a programmer, you don't have any influence over the users of the portal, and how they compose their individual pages - thus your applications should behave well and respect their own (portal-provided) namespace instead of relying on anything global that could easily clash with the same app twice on a page, or with another app that happens to choose the same names in the global (DOM) namespace.

Also, check for the SPA framework that Liferay uses by default.

That being said: Yes, you can do everything. Depending on what you actually do, and what effect you expect, you might need to limit yourself (or ask a more specific question when you run into issues. Asking for "everything" is a bit broad)

Lee Jordan, modified 2 Years ago.

RE: Can I use React into Liferay?

Expert Posts: 449 Join Date: 5/26/15 Recent Posts

IMHO keep it outside of Liferay. I would not touch React unless I was being forced too. I wouldn't, I like to get things done.

Try Remote Apps in 7.4
https://liferay.dev/blogs/-/blogs/remote-apps-how-to-use-liferay-7-4-new-feature-

Why do I say this?
1) You may at some point move away from Liferay, your app is still there.
2) You may want your app to be on Liferay and Sharepoint, easy it's in neither.
3) Trying to develop anything on Liferay is difficult and the workflow for building react (or vue) into a module to deploy will slow you down (double compilation).

If your app is simple, something like rendering weather data ... you're gonna get it done a heck of a lot faster if you choose the lightest and easiest javascript framework and React is not that framework.