CONDITIONALS

 CONDITIONAL STATEMENTS (IF) CAN BE PASSED AS TERNARY OPERATORS OR EVEN BY USING( &&) LOGICAL AND OPERATOR.

import "./Product.css";
function Product({ title, price, features }) {
  return (
    <div className="Product">
      <h4>{title}</h4>
      <h5>price:{price}</h5>

      {price > 15000 ? <p>Discount of 5%</p> : null}
      {/* <p>{features.map((feature) => <li>{feature}</li>)}</p> */}
    </div>
  );
}
export default Product;


LOGICAL AND OPERATOR.

      {price > 15000 && <p>Discount of 5%</p> }


Comments

Popular posts from this blog

DEPENDENCIES IN useEffect()

ACTIVITY1