Skip to main content
added 285 characters in body
Source Link
Manish Anand
  • 849
  • 2
  • 18
  • 33

That's because items and the data are null and you are trying to access a property 'length' of a null value . You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;

If you set items=''; - It means item is null and console.log(typeof items); will return an object. Null is an object. However, if you just declare let items; and console.log(typeof items); will return undefined

So if you set items=''; , your original code should work.

That's because items and the data are null and you are trying to access a property 'length' of a null value . You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;

That's because items and the data are null and you are trying to access a property 'length' of a null value . You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;

If you set items=''; - It means item is null and console.log(typeof items); will return an object. Null is an object. However, if you just declare let items; and console.log(typeof items); will return undefined

So if you set items=''; , your original code should work.

added 66 characters in body
Source Link
Manish Anand
  • 849
  • 2
  • 18
  • 33

That's because items and the data are null and you are trying to access a property 'length' of a null value . You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;

That's because items and the data are null. You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;

That's because items and the data are null and you are trying to access a property 'length' of a null value . You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;
Source Link
Manish Anand
  • 849
  • 2
  • 18
  • 33

That's because items and the data are null. You can put a check like

if(this.items && this.items.data) {
   return (this.items.data.length > 0)
}
  return false;