Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

218 react virtual dom #221

Merged
merged 3 commits into from
Dec 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/react/2-intro-to-jsx.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,16 @@ If you want to iterate within JSX, use methods such as `Array.map`, `Array.filte
```jsx
// Mapping values to JSX elements
<div>
{[1, 2, 3, 4].map((n) => (
<span>n</span>
{[1, 2, 3, 4].map((n, index) => (
<span key={index}>{n}</span>
))}
</div>
```

@highlight 3

_Note: Due to how React [stores elements in memory](https://reactjs.org/docs/lists-and-keys.html#keys), list items require a stable `key` to identify them in the [Virtual DOM](https://reactjs.org/docs/faq-internals.html)._

```html
<div>
<span>1</span>
Expand Down
2 changes: 1 addition & 1 deletion src/react/react.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In a nutshell, React is a [front-end](https://www.coursereport.com/blog/front-en

While it's most commonly used for building web apps, React can also be used to create mobile & desktop apps through [React Native](https://reactnative.dev/) and [Electron](https://www.electronjs.org/). Although this course will not explicitly cover them, the theory contained here will still fully apply to other environments.

React's goal is to enable developers to break down the view layer of their apps into small, reusable chunks called [components](https://reactjs.org/docs/components-and-props.html). In turn, the components are rendered as plain HTML and will automatically update whenever the data in your app changes. We refer to the data driving the application as _state_.
React's goal is to enable developers to break down the view layer of their apps into small, reusable chunks called [components](https://reactjs.org/docs/components-and-props.html). These components are rendered as plain HTML and tracked in memory as [Virtual DOM](https://reactjs.org/docs/faq-internals.html) objects. As data or _state_ in the application changes, the underlying Virtual DOM is updated and we see the coresponding markup change. This makes React very efficent at making updates as only components that have changed will be rendered again.

One of the best things about React is that it can be used in any website, even one that is already built with another framework. This makes it easy to convert an existing project to React, or just use it for one part of a site.

Expand Down