Thursday, August 5, 2021

How to Use React Application Into Salesforce

 We can include  React Application into Salesforce with the help of using Lightning Container in VF/Aura/Lwc component 

The lightning container component hosts your custom JavaScript application in an iframe within your lightning pages ie you can embed any js application in salesforce lightning component using lightning container

      Features of Lightning Container

  • Lightning Container allows you to use an application developed in 3rd party framework like:- Angular, React Js etc. in Lightning Component.
  • Lightning Component can handle messages as well as errors from your embedded app in it's controller.
  • In the same way as above, the embedded javascript application can also handle messages as well as errors, from your lightning component
  • You can also call apex from your custom lightning:container application
Step For :React Application Into SalesForce
  • Create React Js Application
  • Build React Js Application
  • include below code into manifest.json
  •   "landing-pages": [ {
                    "path": "index.html",
                    "apex-controller": "LightningContainerDemo"
} ]
  •  Create Apex Class into Saelesforce with Name LightningContainerDemo
  •  Create a Zip file of Build Folder 
  •  Create Static Resource into SalesForce ,give same Name of build folder
  •  Create Lighting Aura component  with lightning:container
  •  Give Src value of the lightning:container= static resource 
src="{! $Resource.lightningcontainerDemo + '/index.html' }"
  •  Create Lighting App /Community and Use Lighting Aura component
  •  Open that App /Community






No comments: