Link to project/exercise
I have an error regarding map that I don’t know what’s causing it. My code is exactly the same as the solution code.
From investigating on the console the error is as follows:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map') at BusinessList.render (BusinessList.js:9:1) at finishClassComponent (react-dom.development.js:17485:1) at updateClassComponent (react-dom.development.js:17435:1) at beginWork (react-dom.development.js:19073:1) at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1) at invokeGuardedCallback (react-dom.development.js:4056:1) at beginWork$1 (react-dom.development.js:23964:1) at performUnitOfWork (react-dom.development.js:22776:1) at workLoopSync (react-dom.development.js:22707:1)
The BusinessList.js code is as follows:
import React from 'react';
import './BusinessList.css';
import Business from '../Business/Business';
class BusinessList extends React.Component {
render() {
return (
<div className="BusinessList">
{
this.props.businesses.map(business => {
return <Business business={business} key={business.id} />
})
}
</div>
);
}
}
export default BusinessList;