I have a lightning component that may or may not accept query parameters.
In the connected callback, I am trying to grab parameters from currentPageReference and if there are query params then I perform some operation.
@wire(CurrentPageReference )
currentPageReference ;
connectedCallback(){
if(this.currentPageReference && this.currentPageReference.state.c__randomdata) {
performAPICallouts();
}
}
My understanding is that the connected callback executes only once. Can I be certain that the currentPageReference will receive data before connectedCallback Lifecycle hook executes?
Or Can the connectedCallback execute before param is loaded in currentPageReference.
This blog shows the above approach. https://www.infallibletechie.com/2020/05/lightning-record-form-lwc-in-salesforce.html
Any good suggestion or solution on solving this ?