modul:ffit:react:learningunits:lu01:using-variables

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:using-variables [2024/12/05 07:26] kdemircimodul: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 "props" to our function, we can use it in our function to display value given to this component+We can use variables to populate our component dynamically. In JSX we need to use the curly brackets {} to display the value. If we add the parameter "props" to our function, we can use it in our function to display the value given to this component.
  
 Product.js Product.js
-<code javascript>+<file javascript Product.js >
 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 in our component brackets.+We can nest components and also use other elements in our component brackets.
  
-Sidebar.js+Content.js
 <code javascript> <code javascript>
-export default function Sidebar(props) {+export default function Content(props) {
   return (   return (
-    <aside>+    <section className="content">
       {props.children}       {props.children}
-    </aside>+    </section>
   )   )
 } }
Zeile 76: Zeile 76:
 App.js App.js
 <code javascript> <code javascript>
-import Sidebar from "./Sidebar.js"+import Content from "./Content.js" 
 +import ProductsList from "./ProductsList.js"
  
 export default function App() { export default function App() {
   return (   return (
     <div className="app">     <div className="app">
-      <Sidebar+      <Content
-        This is my content for my sidebar+        This is my content. 
-      </Sidebar>+        <ProductsList /> 
 +      </Content>
     </div>     </div>
   )   )
 } }
 </code> </code>
  • modul/ffit/react/learningunits/lu01/using-variables.1733379984.txt.gz
  • Zuletzt geändert: 2024/12/05 07:26
  • von kdemirci