score:0

class ShopDetails extends Component {
  constructor(props) {
    super(props);
    this.state = {  }
  }
  render() { 
    console.log("Props shops: ", this.props.shops);
    const id = this.props.match.params.id;
    console.log("id: ", id);
    const data = this.props.shops || {};
    console.log("data: ", data);
    const shop = data.find(s => s.id == id);
    console.log("const shop = data.find(...): ", shop);

    return (
      <div className="container">
        <Row>
          <Col>
            {shop ? (
              <Image
                alt=""
                src={shop.imgURL}
                width={150}
                height={150}
                rounded
              />
            ) : null}
          </Col>
          <Col  >
           {shop ? <h1>{shop.nom}</h1> : null}
          {shop ? <h2>A partir de {shop.startPrice} €</h2> : null}
          </Col>
        </Row>
        <Row >
          <Col >
            <h3>Site internet:</h3>
           {shop ? <p>{shop.website}</p> : null}
          </Col>
          <Col >
            <h3>Services</h3>
            <p>Rappel des services</p>
          </Col>
        </Row>
        <Row >
          <Col>
            <h4>Présentation</h4>
            {shop ? <p>{shop.resume}</p> : null}
          </Col>
        </Row>
      </div>
    );
  }
}

export default ShopDetails;

Related Query

More Query from same tag