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
LUIGI EMANUEL TAORMINALUIGI EMANUEL TAORMINA 

how to connect one component to another component?


hi, I'm creating a lightning application the purpose is to show all the Books in a component with the intent of selecting a book and to create a purchase proposal. after having created a component which shows me the cards of the books, selecting a book should redirect me to another component that acts as a cart to continue my 'order'. How can you connect a component that at the click of a button redirects me to another component where it shows me the cart page on the screen?
 
Best Answer chosen by LUIGI EMANUEL TAORMINA
PriyaPriya (Salesforce Developers) 
Hey Lungi,

Kindly try this below sample code :- 
({
    gotoURL:function(component,event,helper){
        console.log('Enter Here');
        var evt = $A.get("e.force:navigateToComponent");
        console.log('evt'+evt);
        evt.setParams({
            componentDef: "skbteqforce:AccountCreateComponent",
            //componentAttributes :{ //your attribute}
        });
       
    evt.fire();
    }
})

For more reference, refer this link :- 

https://salesforce.stackexchange.com/questions/88767/lightning-app-redirect-from-1-component-to-another-component

https://developer.salesforce.com/forums/?id=9060G000000I1ClQAK

If the above solution helps, then kindly mark it as the best answer.

Thank you