Just like Aura Components in Lightning Web Components also we can invoke Apex methods.
So Apex is going to act like server-side technology in case of both Aura Components and Lightning Web Components.
In this post let's look at how to invoke Apex methods from Lightning Web Components imperatively.
We can also invoke Apex methods from Lightning Web Components by using @wire decorator.
Let me quickly walk you through the difference, in the imperative approach, we will invoke the Apex method on click of a button or click (method gets invoked on click of a button or link) whereas with @wire decorator we will invoke the Apex method automatically after the component is initialized.
Here is the snippet to invoke the component Imperatively!
Hope this was helpful!
Subscribe to Salesforce Casts
Get the latest posts delivered right to your inbox