0

I have to upgrade an existing application with new features. It is an MPA web application, developed using the express framework under Node, and serving the HTML from EJS templates. I'm ok about using vanilla JS/jQuery but I'm curious if it would be possible to integrate a React based UI component library, like PrimeReact, to use some of its components in the EJS files to make the development easier.

I know that I should install and configure Babel for transpiling the JSX but I couldn't find any examples about how to do it and how to use the React component in the EJS template.

Anyone with a similar case? Cheers!

2
  • You can leverage renderToString function of React, to render a react component inside ejs templates or even ejs.render(), for using renderToString, you;ll need a babel preset, otherwise its a no-go. Here is an example. Commented Apr 19, 2021 at 12:11
  • Hi! I've checked the link you provided and also some articles but I have too many doubts and too little time. For now, I'll use jQuery and I'll update the question as soon as I have time to do some tests with the React components. Thanks! Commented Apr 20, 2021 at 12:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.