Ravenous - Part 2

I worked on the project and then compared it to the solution to see my mistakes. One thing I am having trouble with is that how come can we use this.props.businesses in BusinessList.js without importing App.js? const businesses was defined in App.js so I was expecting the solution to import this file in BusinessList.js ?

BusinessList.js below:

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} />
          })
        }
      </div>
    );
  }
}

export default BusinessList;
1 Like

I would like to know the answer to this question as well. I think it might be because App.js is our parent component?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.