Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| modul:ffit:react:learningunits:lu01:using-variables [2024/12/05 07:27] – kdemirci | modul:ffit:react:learningunits:lu01:using-variables [2024/12/18 16:11] (aktuell) – kmaurizi | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== LU01b - Using Variables ====== | ====== LU01b - Using Variables ====== | ||
| - | We can use variables to fill out our component dynamically. In JSX we have to use the curly brackets {} to display value. If we add the parameter " | + | We can use variables to populate |
| Product.js | Product.js | ||
| - | <code javascript> | + | <file javascript |
| export default function Product(props) { | export default function Product(props) { | ||
| return ( | return ( | ||
| Zeile 20: | Zeile 20: | ||
| ); | ); | ||
| } | } | ||
| - | </code> | + | </file> |
| ProductsList.js | ProductsList.js | ||
| Zeile 61: | Zeile 61: | ||
| ===== Using children of component ===== | ===== Using children of component ===== | ||
| - | We can nest components and also use other element | + | We can nest components and also use other elements |
| Content.js | Content.js | ||
| Zeile 77: | Zeile 77: | ||
| <code javascript> | <code javascript> | ||
| import Content from " | import Content from " | ||
| + | import ProductsList from " | ||
| export default function App() { | export default function App() { | ||
| Zeile 83: | Zeile 84: | ||
| < | < | ||
| This is my content. | This is my content. | ||
| + | < | ||
| </ | </ | ||
| </ | </ | ||