Ravenous: Part 4 error

In the below project when I click “Let’s go” button , it shows this error:
TypeError: Cannot read property ‘map’ of undefined
Exercise link:
https://www.codecademy.com/paths/web-development/tracks/front-end-applications-with-react/modules/ravenous-part-four/projects/interacting-with-yelp-api

Hi,

The .map method expects to be called on an array. The error means that this.props.businesses has not been defined.

Have a look back through your code and see if you can find a reason for this. If you’re still struggling share your code with us and someone can take a closer look.

As well as winningblue’s suggestion, you’re far from the first person to encounter this issue and come here for help. If you search the forums, you may find the solution to your issue in one of the other topics. :slight_smile:

In line 11, why super(props) was crossed out?

I’ve never seen that before in Visual Studio Code, but if you hover your mouse over the function name it may tell you why it’s showing with a strikethrough.

I find solution and fix super(props) strikethrough in Visual Studio Code’s settings.
Solution

I did some digging as someone else also mentioned this issue and indeed I found it to exist in my own code when I revisited it.

We are being taught to use the React legacy API in this lesson, which is soon to be discontinued. The strike through is alerting you to that.

I contacted the help desk and they said the team are working on updated React lessons which they plan to release by the end of the month.

1 Like