Skip to content

Commit 433b44e

Browse files
committed
updates
1 parent 38f52b1 commit 433b44e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

react-state/8.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# What Is Component State?
22

3-
Most components should simply take in props and render. But, components also offer state, and it is used to store information about the component that can change over time. Typically the change comes as a result of user events or system events (i.e., as a response to user input, a server request or the passage of time).
3+
Most components should simply take in props and render. But, components also offer state, and it is used to store information about the component that can change over time. Typically the change comes as a result of user events or system events (i.e., as a response to user input, a server request, or the passage of time).
44

55
According to the React documentation state should:
66

react-state/8.2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ In the code example below I am creating a `<MoodComponent />` that demonstrates
88
99
Note that the `<MoodComponent />` has an initial state of ':|', that is set using `getInitialState: function() {return {mood: ':|'};}`, which is used in the component when it is first rendered by writing, `{this.state.mood}`.
1010

11-
To change the state, an event listener is added; in this case a click event (i.e., `onChange`) on the `<span>` node that will call the `changeMood` function. Within this function I use `this.setState()` to cycle to the next mood based on the current mood/state. After the state is update (i.e., `setState()` merges the changes) the component will re-render itself and the UI will change.
11+
To change the state, an event listener is added; in this case a click event (i.e., `onClick`) on the `<span>` node that will call the `changeMood` function. Within this function I use `this.setState()` to cycle to the next mood based on the current mood/state. After the state is update (i.e., `setState()` merges the changes) the component will re-render itself and the UI will change.

0 commit comments

Comments
 (0)