function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
si risi ri 

How to call Lightning component from visualforce component?

I would like to keep a link in the VF component and from that link I need to open Lightning component.
AnudeepAnudeep (Salesforce Developers) 
I know that we cannot use a visualforce component in lightning component. Unsure if we can use lightning components inside a VF component

Even if you have to do it, lightning out is the only way possible. 
 
<apex:component >
<apex:includeLightning />
<script>
        var myUserContext = "{!$User.UITheme}";
  
        $Lightning.use("c:sampleApp", function() {
        $Lightning.createComponent(
            "c:samplecomponent",
            { UserContext: myUserContext },
            "myDivId",
            function(cmp) {
                console.log('component created');
                console.log(cmp);
            });
        });
     </script>
    <apex:attribute name="myValue" description="This is the value for the component."
        type="String" required="true"/>

    <apex:attribute name="borderColor" description="This is color for the border."
        type="String" required="true"/>

    <h1 style="border:{!borderColor}">
        <apex:outputText value="{!myValue}"/>
    </h1>

</apex:component>

You can give a try to see if it works

Anudeep
si risi ri
This one I already tried. Not working.