I have a function in LWC which is getting invoked if Wire brings some values from Apex. but issue here i am facing is function is still getting called when data=[]
Logic : Wire
@wire(getRFCt, { crid: '$crid' }) wired({ error, data }) {
const functionName = 'wired';
if (error) {
//Log to print Error
}
else if (data) {
{
this.ceSler(data);
console.log("data is here" + JSON.stringify(data));
}
}
}
function
ceSler(data) {
if (data !== []) {
/// Logic for Functio
});
}
}
data is here[{"T_R_R":"ASD-SDF-DFG","Id":"hgjfhgjf"}]
data is here[]
How to invoke the function only when (data is here[{"T_R_R":"ASD-SDF-DFG","Id":"hgjfhgjf"}]) value is present in data currently not sure why it is getting invoked for both. kindly help me out for this.