Wire Apex method to a function using @wire decorator in LWC
This is the best option when it comes to using @wire decorator, tell you why with this variant we can debug the data that we get back from the Apex method.
It's not that we cannot debug it when we wire an Apex method with a property, but there is a bit of process that's involved to see the output with this approach. We need to use the template file and use <template for:each="" for:item=""></template> to debug the code.
Let me walk you through the sample code.
And here is the controller file!
Hope this helps!
Subscribe to Salesforce Casts
Get the latest posts delivered right to your inbox