1

What I understand till now is that ReactJS component cannot be used as-is in other applications (JSP).

There is an approach like mentioned in below link, but seems its not recommended for production build: How to import react component in jsp page Spring boot.

The other approach is to use Web-components which is interoperable.

I found that the ReactJS can be converted to Webcomponents by using few libraries like react-to-web-components: https://github.com/bitovi/react-to-webcomponent

I followed one approach by converting one such ReactJS component to a Web-component and bundle it to a single .js bundler by following steps as mentioned in link below: Bundle react app created with npx create-react-app to .js file using Webpack

The component still fails to load in my JSP with error:
'CustomElementRegistry': “[object HTMLElement]” is not a valid custom element name

How can I create components in ReactJs and use those in my JSP project?
I am new to React and Web-component. Could you please help me with some references and examples?

Cloud30001
  • 75
  • 1
  • 7
  • If you haven't invested in learning technologies yet, disregard React. See https://stackoverflow.com/questions/64304353/main-differences-between-lit-element-react – Danny '365CSI' Engelman Jul 25 '21 at 12:05

0 Answers0