You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In React, we are able to return markup language (like HTML) from functions. This is called **JSX** (JavaScript XML).
68
+
In React, we are able to return HTML-like syntax from functions. This is called **JSX** (JavaScript XML), which allows us to execute JavaScript expressions (inside `{}`) and/or pass in data.  
69
69
70
70
### B. Component Composition is fast and easy to read
71
71
72
-
**Components** let you split the UI into independent, reusable pieces, and think about each piece in isolation.
72
+
**Components** let you split the UI into independent, reusable pieces and think about each piece in isolation.
73
73
74
74
**Component Composition** is the process of combining smaller, reusable components together to create larger, more complex components
75
75
@@ -138,7 +138,7 @@ cd <name of your project> && npm i
138
138
npm run dev
139
139
```
140
140
141
-
By default you will be given the familiar counter app. Take a look around! Every React project made by Vite will have this rough structure:
141
+
By default, you will be given the familiar counter app. Take a look around! Every React project made by Vite will have this rough structure:
142
142
143
143
*`index.html` — the HTML file served to the client. It loads `src/main.jsx`.
144
144
*`src/main.jsx` — the entry point of the app. It uses the `react-dom/client` package to render the **root component**`App` into the DOM.
@@ -151,31 +151,32 @@ By default you will be given the familiar counter app. Take a look around! Every
151
151
152
152
How does all of this actually get to the screen? Head over to the `main.jsx` file.
153
153
154
-
The primary purpose of this file is render the root component `App`. To do so we:
154
+
The primary purpose of this file is to render the root component `App`. To do so we:
155
155
156
156
* Import a package called `ReactDOM`
157
-
* Use the `ReactDOM.createRoot` method to create a `root` object.
158
-
* Then we call `root.render` and pass in the `App` component.
157
+
* Use the `createRoot` method to create a `root` object.
158
+
* Then we call `createRoot(root).render()` and pass in the `App` component as the argument.
159
159
160
160
This is mostly handled when Vite creates the project for you so no need to memorize it:
0 commit comments