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?

1

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.