Life Cycle Hooks vs Wiring Apex method to a function
Scenario - Want to debug and check if required data is being sent from Apex method to Web Component?
Possible solution - Creating a property, wiring it to the apex method and checking the value of the property in one of the Life Cycle Hooks.
Problem - Apex method will be invoked after all the Life Cycle Hooks are invoked so the above approach will not be of any help.
Optimised Solution - Wire Apex method to a function instead of a property. If you try to understand what happens here, all the Life Cycle Hooks are invoked and then it will automatically wire the apex method to the function and with in the function you can log the data sent back by apex method.
Hope this helps!
Subscribe to Salesforce Casts
Get the latest posts delivered right to your inbox