Ravenous Part 2 - business is undefined

I am getting TypeError: business is undefined as show below.

Here is my Business.js code, can someone guide why I might be getting this error?

import React from 'react';
import './Business.css';
import '../App/App'

class Business extends React.Component {
    render() {
      const { business } = this.props;
      return (
        <div className="Business">
        <div className="image-container">
          <img src='https://s3.amazonaws.com/codecademy-content/programs/react/ravenous/pizza.jpg' alt=''/>
        </div>
        <h2>{business.name}</h2>
        <div className="Business-information">
          <div className="Business-address">
            <p>{business.address}</p>
            <p>{business.city}</p>
            <p>{business.state} {business.zipCode}</p>
          </div>
          <div className="Business-reviews">
            <h3>{business.category}</h3>
            <h3 className="rating">{business.rating} stars</h3>
            <p>{business.reviewCount} reviews</p>
          </div>
        </div>
      </div>
    );
    }
}

export default Business;

Keep following the definitions to where the mistake is.
If business is supposed to be something in particular and it isn’t that, then you’d look at the thing that sets it, and if it gets values from somewhere you’d continue looking there and so on.

1 Like