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
Navin Ganeshan 10Navin Ganeshan 10 

LWC: connectedCallback vs. @wire

All,

I am new LWC and documentations have been immensly useful to get me started on this journey. However, while looking at various examples on getting data from objects, i see examples randomly using @wire at someplace and connectedCallback at others. 

question for this group is:
  • what is the basic difference between these 2
  • which situation would call for choosing between these 2 methods
  • @wire does not fire sometime (i mean no calls to the apex method at all)
Thanks,
Navin
Best Answer chosen by Navin Ganeshan 10
ANUTEJANUTEJ (Salesforce Developers) 
Hi Navin,

I found the below article regarding the @wire decorator and connectedCallback().

Can you please have a look at it once.

>> https://www.salesforcecodecrack.com/2019/01/wire-service-in-lightning-web.html

>> https://salesforcediaries.com/2019/12/13/connectedcallback-in-lightning-web-component/

I hope this helps and in case if this comes handy can you please choose this as best answer so that it can be used by others in the future.

Regards,
Anutej