After completing the project successfully, I decided to run a location query outside the yelp coverage countries.
I got a response on the screen. See details below. Any hint on how I can return a specific message of the search query cannot be found.
Thanks
TypeError: Cannot read property ‘map’ of undefined
BusinessList.render
src/components/BusinessList/BusinessList.js:8
5 | class BusinessList extends React.Component { 6 | render() { 7 | return (> 8 | <div className="BusinessList"> 9 | { 10 | this.props.businesses.map(business => { 11 | return <Business key={business.id} business={business}/>;
View compiled
18 stack frames were collapsed.
(anonymous function)
src/components/App/App.js:23
20 | 21 | searchYelp(term, location, sortBy) { 22 | Yelp.searchYelp(term, location, sortBy).then( businesses => {> 23 | this.setState({ businesses: businesses }); | ^ 24 | 25 | }); 26 | };
View compiled
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.