modul:ffit:react:learningunits:lu01:defining-a-component

Dies ist eine alte Version des Dokuments!


LU01a - Creating a component

With function Product() { } you define a JavaScript function with the name Product. This is also going to be our components name

function Product() {
 
}

Each component must return a value. We create a return() using JSX markup. This is a special markup language made for React that allows HTML to be written in JS as well.

function Product() {
  return (
    <div>
      <img src="https://placehold.it/800" alt="Product Image" />
    </div>
  );
}
  • modul/ffit/react/learningunits/lu01/defining-a-component.1733378449.txt.gz
  • Zuletzt geändert: 2024/12/05 07:00
  • von kdemirci