I have a requirement to Reload a lightning component from a Visualforce page based on the Tab clicked in VF page with different Values.
<a id="{!formKey}" onclick="hideShowPickList('{!ptConfigstng.PT_ObjectName}','{!ptConfigstng.PT_CompName}',{!formKey})" onload="hideShowPickList('{!PTConfigSttngLSt[0].PT_ObjectName}','{!PTConfigSttngLSt[0].PT_CompName}',0)" class="slds-tabs--default__link"> {!ptConfigstng.PT_ObjectName} </a>
A new component gets created below the old component everytime a different link is clicked.
Need to reload that original component by passing the value from the Visualforce page or Clear the Old component and create a new with current Values
<script type="text/javascript">
function hideShowPickList(ObjName,CompName,loopnum){
debugger;
$Lightning.use("c:App_Details", function() {
console.log('app invoked');
$Lightning.createComponent("c:LCSearch",{
PTObjName : ObjName,
PTCompName : CompName},"lightning",
function(component) {
console.log('component invoked');
});
});
}
Suggest me If am wrong here with Best practice methods.