STYLE COMPONENTS

 STYLING CAN BE ADDED IN A SINGLE FILE.

BUT IN REACT WE ADD STYLING BY COMPONENTS , FOR EACH COMPONENT STYLING IS ADDED SEPERATELY.

FOR App.jsx => App.css

      Product.jsx => Product.css

FOR EACH COMPONENT A SEPERATE CSS FILE IS CREATED.

UNLIKE HTML WHERE A CSS FILE IS ADDED BY USING <link> TAG, HERE WE IMPORT THE CSS FILE.

Product.css

.Product{
    border: 2px solid white !important;
    border-radius: 15px;
    margin-top: 15px;
    padding: 0 10px 0 10px;
}

Product.jsx

import "./Product.css";
function Product() {
  return (
    <div className="Product">
      <h4>Product Title</h4>
      <h5>Product Description</h5>
    </div>
  );
}
export default Product;


Comments

Popular posts from this blog

DEPENDENCIES IN useEffect()

ACTIVITY1

CONDITIONALS