Skip to main content
edit
Source Link
Pankaj Parkar
  • 136.3k
  • 23
  • 241
  • 307

You could check if desir data.hits exists inside state.

{this.state.data && this.state.dataArray.hits && isArray(this.state.data.hits.length) ? 
     this.loopListings()
     : null}

Also make sure that, after retrieving a data cal this.setState method like below.

this.setState({ data })

You could check if desir data.hits exists inside state.

{this.state.data && this.state.data.hits && this.state.data.hits.length ? 
     this.loopListings()
     : null}

Also make sure that, after retrieving a data cal this.setState method like below.

this.setState({ data })

You could check if desir data.hits exists inside state.

{this.state.data && Array.isArray(this.state.data.hits) ? 
     this.loopListings()
     : null}

Also make sure that, after retrieving a data cal this.setState method like below.

this.setState({ data })
Source Link
Pankaj Parkar
  • 136.3k
  • 23
  • 241
  • 307

You could check if desir data.hits exists inside state.

{this.state.data && this.state.data.hits && this.state.data.hits.length ? 
     this.loopListings()
     : null}

Also make sure that, after retrieving a data cal this.setState method like below.

this.setState({ data })