Skip to content

Commit 3c019af

Browse files
authored
Merge pull request #130 from AurelioGomezRosales/patch-6
Update README.md
2 parents 5de4040 + 1f779ef commit 3c019af

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

04 Callback/readme.md

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# 04 Callback + State
22

3-
In this sample we are going to refactor the previous sample **03 State**.
3+
In this example we refactor the previous **03 State** example.
44

5-
We'll update the name property only when the user clicks on
6-
a _change_ button, we will simplify the event itself as well.
5+
We update the name property only when the user clicks a _change_ button, and we simplify the event itself as well.
76

8-
Obviously, we will take the sample **03 State** as a starting point.
7+
Obviously, we take the example **03 State** as a starting point.
98

109
Summary steps:
1110

1211
- Add a button to the `EditName` component and a handler function for this.
13-
- Submit the name only when the user clicks on the button.
12+
- Submit the name only when the user clicks that button.
1413
- Update the `app` component to handle the new simplified event.
1514

1615
## Prerequisites
@@ -21,19 +20,17 @@ Install [Node.js and npm](https://nodejs.org/en/) (v6.6.0) if they are not alrea
2120
2221
## Steps to build it
2322

24-
- Copy the content of the `03 State` folder to an empty folder for the sample
25-
and make this your current folder.
23+
- Copy the content of the `03 State` folder to an empty folder for this example and make this your current folder.
2624

2725
- Install the npm packages described in the `package.json` and verify that it works:
2826

2927
```bash
3028
npm install
3129
```
3230

33-
- Since we are going to use an internal handler, we'll transform the `NameEditComponent`
34-
from a stateless component into a class component, then we will add some refactor on the naming.
31+
- Since we are going to use an internal handler, we'll transform the `NameEditComponent` from a stateless component into a class component, then we will add some refactor on the naming.
3532

36-
The `nameEdit.tsx` file should looks like this:
33+
The `nameEdit.tsx` file should look like this:
3734

3835
_nameEdit.tsx_
3936

@@ -125,7 +122,7 @@ export class App extends React.Component<Props, State> {
125122
```
126123

127124

128-
Now we've got a clear event, strongly typed and simplified (straight forward).
125+
Now we've got a clear event, strongly typed and simplified (as it is more straightforward).
129126

130127
- Let's give it a try:
131128

@@ -135,6 +132,6 @@ export class App extends React.Component<Props, State> {
135132

136133
- Then, load http://localhost:8080/ in a browser to see the output.
137134

138-
Now, the greeting only change when the user clicks on the change button.
135+
Now, the greetings message only changes when the user clicks the change button.
139136

140-
> What happens if we simulate an AJAX call, let's place in the app on componentWillMount a timeout and set the name value.
137+
> What happens if we simulate an AJAX call? Let's place in the app's componentWillMount a timeout and set the name value in the timeout's callback.

0 commit comments

Comments
 (0)