Wire Apex method to a function using @wire decorator in LWC
Let's look at how to Wire the 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!