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

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
modul:ffit:react:learningunits:lu01:defining-a-component [2024/12/05 07:07] kdemircimodul:ffit:react:learningunits:lu01:defining-a-component [2024/12/05 07:08] (aktuell) kdemirci
Zeile 20: Zeile 20:
     <div>     <div>
       <img src="https://placehold.it/800" alt="Product Image" />       <img src="https://placehold.it/800" alt="Product Image" />
 +      <h2>Product Name</h2>
 +      <p>Product Description</p>
 +      <p>$20</p>
     </div>     </div>
   );   );
Zeile 27: Zeile 30:
 ===== Export the component ===== ===== Export the component =====
  
-Now we have a component. But if we want to use it in other files, we have to export the function. To export a component, you have to add the keywords "export default" in front of the function declaration. That way, the function is marked to be exported. Nowyou can include the file in an another file to use this component. +Now we have a component. But if we want to use it in other files, we need to export the function. To export a component, you need to add the keywords "export default" before the function declaration. This will mark the function to be exported. Now you can include the file in another file to use this component.
  
 Product.js Product.js
  • modul/ffit/react/learningunits/lu01/defining-a-component.1733378833.txt.gz
  • Zuletzt geändert: 2024/12/05 07:07
  • von kdemirci