7

Currently the applications are built in ReactJS on top of VF Page.

As part of enhancement, new components need to be built. Also they need to communicate with each other.

I am planning to have LWC going forward, so that I could reuse these for Lightning migration later on.

Can LWC be part of ReactJS app?

3

I'm pretty sure, you would need to use the Lightning Out feature of the Aura framework. This would render an Aura Component App, which would then in turn render an Aura component wrapper around an LWC.

So essentially, the architecture would be:

VisualforcePage
  |- ReactJS
  |- apex:includeLightning Visualforce tag
     |- AuraComponent App: myLightningApp.app
        |- $A.createComponent on LWC wrapper
           |- LWC: c:myLWCComponent

Given React's strong ownership of the DOM and rendering, honestly, I'm not sure how well all of this would work together. For instance having LWC and the React app interact for instance.

If you think about this, it is the same interoperability structure as using an Aura component, just that you'd use the LWC in place of the Aura component.

My guess is that you'd hoped that there was some way to stand up LWC and have them work directly with React. That's not possible as of today.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.