Ravenous Part 4 Error

I keep getting the below error when trying to run the ravenous part 4 code. I’ve triple checked my js code against the ‘solution code’ and everything matches. Any help please!!!???

Hi!

Without seeing your code in full I think we might still be able to help based on the error message.

I’m still early into learning too and I’ve found a great way to find answers and solutions is to simply google error messages. If you look this one up you’ll find that the map method is expecting to be called on an array. The way it has responded means that this.props.businesses is not an array and has not even been defined.

Check the chain that passes the props, it would seem something is wrong there. Without seeing your code I can’t tell but are you sure you need to be using this.props and not this.state?

Yes; the App component is the ultimate parent and contains the businesses as part of it’s state. App renders the BusinessList component, passing businesses down as a prop. :slight_smile:

One suspect ruled out then!

That mix up has tripped me up a few times in the past so thought it was worth a shot in the dark.

1 Like

I was having the same error as well. At first I discovered this error and realised I had forgotten to change a few class to className in my SearchBar
Annotation 2020-09-10 132959

But ultimately my error came down to this:
Annotation 2020-09-10 132960

I have spent the better part of 90 minutes trying to figure out what was wrong with that code. Reading all the posts from people who had the same issue. Re-watching the video walkthrough to see if mine added up. Ending up opening the solution code and and reading the two side by side.
Turns out I’d put

BusinessList businesses={this.state.businessess}

instead of

BusinessList businesses={this.state.businesses}

Ninty minutes of my life wasted on a rogue ‘s’.
Check for the smallest of typos. It could be that.

1 Like

I believe the OP fixed the issue, as they posted about it on another existing topic as well: