Skip to content

Commit c3dd199

Browse files
committed
add more details to the ui state exercise
1 parent efc9217 commit c3dd199

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Diff for: exercises/01.managing-ui-state/README.mdx

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
11
# Managing UI State
22

3-
Normally an interactive application will need to hold state somewhere. In React,
4-
you use special functions called "hooks" to do this. Common built-in hooks
5-
include:
3+
Dynamic applications allow users to interact and make changes to what they see
4+
on the page and the application should respond by updating the UI based on what
5+
the user has done. We accomplish this by using state. When state changes (for
6+
example as the result of user interaction and input), we update the UI. Here's
7+
how that works with React:
8+
9+
```
10+
render --> set up the DOM ↙
11+
user interacts --> state changes ↙
12+
re-render --> update the DOM ↖
13+
```
14+
15+
From there's a cycle of user interaction, state changes, and re-rendering. This
16+
is the core of how React works for interactive applications.
17+
18+
The `render` phase is what what we've done so far with creating React elements.
19+
Handling user interactions is what we've done with event listeners like
20+
`onSubmit`. Now we're going to get into the `state changes` bit.
21+
22+
In React, you use special functions called "hooks" to do this. Common built-in
23+
hooks include:
624

725
- `useState`
826
- `useRef`

0 commit comments

Comments
 (0)