The Products and Promotions pages

Now let's move to writing the product's page component. The code is similar to the products page that we wrote in Chapter 4Frontend with React.js. Let's open the ProductsCards.js file, then write the following code:

import React from 'react';class Card extends React.Component {    render() {        const priceColor = (this.props.promo)? "text-danger" : "text-dark";        const sellPrice = (this.props.promo)?this.props.promotion:this.props.price;        return (            <div className="col-md-6 col-lg-4 d-flex align-items-stretch">                <div className="card mb-3">                    <img className="card-img-top" src={this.props.img} alt={this.props.imgalt} />                    <div className="card-body">                        <h4 className="card-title">{this.props.productname}</h4> Price: <strong ...

Get Hands-On Full Stack Development with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.