Skip to content

Commit 458470b

Browse files
IncognitoDusanSacha
authored andcommitted
English improvements (#130)
* english improvements for problem 1 * Note about JSX * The "omitted" sections confused me at first Omitting them doesn't save a ton of space, and it's not clear that you're not supposed to change them from the previous iteration, so I put them back. * Better solution to the "omitted" confusion Now that I've passed this exercise and see that the following exercises use the same pattern, I put things back how they were but added an explanation of how to read the sample * english improvements for isomorphic problem descr * improved english problem file for Events exercise * some improved english explanation in the isomorphic lesson
1 parent 6185515 commit 458470b

File tree

5 files changed

+43
-34
lines changed

5 files changed

+43
-34
lines changed

exercises/components/problem.en.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ These use HTML tags together with JSX notation.
66
To render a React Component, create a local variable that starts with an
77
upper-case letter.
88

9+
JSX allows you to write near-HTML inline in your JavaScript, rather than writing
10+
JavaScript code that creates and modifies DOM nodes.
11+
912
React's JSX uses the upper vs. lower case convention to distinguish between
1013
local component classes and HTML tags.
1114

@@ -18,7 +21,7 @@ ReactDOM.render(myElement, document.getElementById('example'));
1821
# Challenge
1922
---
2023

21-
Update `index.jsx` as shown below.
24+
Update `views/index.jsx` as shown below.
2225

2326
```
2427
import React from 'react';

exercises/event/problem.en.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
It's time to add new todos! Let's make a form for adding new ones.
1+
It's time to add new todos! Let's make a form for adding them.
22

3-
# Challenge
3+
# Challenge
44
---
55

66
Update `TodoList` in `index.jsx` as shown below.
77

8-
```
8+
```
99
class TodoList extends React.Component {
1010
constructor(props) {
1111
super(props);
@@ -56,6 +56,9 @@ class TodoList extends React.Component {
5656
Now change the three `Write code here` comments into some real code. You'll
5757
want to make each of them use `setState`.
5858

59+
Hint: As the inputs are changed, update the state of the `TodoList` component,
60+
and when the Add button is clicked, use those props to add a new item to data.
61+
5962
When you are ready, run `node program.js 3000 Milk 13:00` and visit
6063
`http://localhost:3000` to see the HTML output in the browser.
6164

exercises/hello_react/problem.en.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ First things first, let's print `Hello World`!
22

33
First, create the directory where you will write your code. It needs to contain a [package.json](https://docs.npmjs.com/getting-started/using-a-package.json) file
44
for npm to know in which folder to install the subsequent packages - `npm init` does this for us.
5+
56
You can change `learnyoureact` to any name you like.
67

78
`$ mkdir learnyoureact; cd learnyoureact; npm init -y;`
@@ -10,11 +11,9 @@ Start by installing the required modules. Run this command:
1011

1112
`$ npm install --save react react-dom express body-parser [email protected] [email protected]`
1213

13-
You can see `node_modules` directory made.
14-
Files of module is in the directory.
14+
This will create your `node_modules` directory and store a bunch of modules in it.
1515

16-
Next, create `program.js`.
17-
Folder structure is below.
16+
Next, create `program.js`. Folder structure is below.
1817

1918
```
2019
learnyoureact
@@ -48,12 +47,13 @@ app.listen(app.get('port'), function() {
4847
```
4948

5049
The code above creates a small Express server that renders our React
51-
components. If someone navigates to `/`, `views/index.jsx` will be rendered. This program uses the `express-react-views` module.
50+
components. If someone navigates to `/`, it will render `views/index.jsx`.
51+
This program uses the `express-react-views` module for view rendering.
5252

53-
Next, create a `views` directory in the same directory as `program.js`.
54-
After that, create `index.jsx` in the 'views' directory.
53+
Next, create a `views` directory in the same directory as `program.js`,
54+
and create `index.jsx` in the 'views' directory.
5555

56-
Please copy the code below into `index.jsx`
56+
Copy the code below into `index.jsx`:
5757

5858
```
5959
import React from 'react';
@@ -67,8 +67,8 @@ export default class TodoBox extends React.Component{
6767
}
6868
```
6969

70-
This code uses the optional React.js JSX syntax to create our views, which we
71-
shall use throughout the rest of this workshop.
70+
This code uses the optional React.js JSX syntax to create our views,
71+
which we shall use throughout the rest of this workshop.
7272

7373
You can find the React.js docs here: https://facebook.github.io/react/docs/getting-started.html
7474

exercises/isomorphic/problem.en.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
Let's use React on the front-end too!
22

3-
From this exercise on, we'll use React not only on the server side but also on the front-end.
4-
Let's raise the event on the front-end, and see what will happen.
5-
In the past exercises, there was some code that raised a front-end event, but it did not work. Where is that?
3+
From this excercise on, we'll use React not only on the server side but also on the front-end.
4+
In fact, we'll use the very same view files for rendering both the server-side initial response, and on the front-end for any DOM manipulation necessary. Sharing the code between the front end and the server is a concept known as Isomorphic JavaScript.
65

7-
The code is the check of the `checkbox` event you wrote in `State`.
8-
At `State`, to tell the truth, you can check the `checkbox` no matter what code you write.
9-
In this exercise, let's confirm if you can write the right code or not.
10-
There is a lot of code to change !
11-
Let's try it!
6+
In past exercises, there was code that triggered an event in the front-end, but nothing happened. Do you know what it was?
7+
8+
It was interactions with the `checkbox` you wrote in the `State` lesson.
9+
In the `State` lesson, to be honest, checking the `checkbox` doesn't actually update the state.
10+
11+
In this excercise, let's make it update `this.state`, which will require running React on the front-end too.
12+
13+
There is a lot of code to change!
1214

1315
# Question
1416
---
1517

16-
Start by installing the required modules. Run the four commands below.
18+
Start by installing the required modules. Run the command below:
1719

1820
```
1921
$ npm install browserify babelify babel-preset-react babel-preset-es2015
2022
```
2123

22-
Next, let's create `app.js` at the same directory as `program.js` and copy the code below into the file.
24+
Next, create `app.js` in the same directory as `program.js` and copy the code below into it:
2325

2426
```
2527
import React from 'react';
@@ -30,12 +32,11 @@ let data = JSON.parse(document.getElementById('initial-data').getAttribute('data
3032
ReactDOM.render(<TodoBox data={data} />, document.getElementById("app"));
3133
```
3234

33-
The above code is to use React at front-end. This code passes `TodoBox` from `index.jsx`, and data from server that are passed in the id of `initial-data` to the element that has the id of `app`.
35+
The above code is to use React on the front-end. This code assumes that there will be some data attached to a DOM element with the id `initial-data`, and passes it into a `TodoBox` from `index.jsx`, and renders the whole component in the element with id `app`.
3436

35-
Next, let's fix `program.js`.
36-
You can also make a new `program.js` file and write all the code there.
37+
Next, let's fix `program.js`. You can change your existing one, or make a new `program.js` file and write all the code there.
3738

38-
First of all, let's add these `require` statements - like this:
39+
First of all, let's add some new variables at the top:
3940

4041
```
4142
var React = require('react');
@@ -49,17 +50,17 @@ var browserify = require('browserify');
4950
var babelify = require("babelify");
5051
```
5152

52-
Next, add a line that reads `index.jsx` under the sentence that `require` s `babel/register`.
53+
Next, add a line that `require`s `index.jsx` under the line that `require`s `node-jsx`:
5354

5455
```
5556
require('babel/register');
5657
5758
var TodoBox = require('./views/index.jsx');
5859
```
5960

60-
Finally, add routes for `/bundle.js` and `/` by copying the code below.
61-
`/bundle.js` will contain `app.js` and dependencies (view template and react) transformed to ES5 and bundled for the browser.
62-
Requests to `/` will render the corresponding react view on the server and respond with HTML, including a script tag with `bundle.js` and data from the server for the react view.
61+
Finally, fix the routes for `/bundle.js` and `/` as shown below.
62+
When `/bundle.js` is requested, you want to respond with the browserified version of `app.js`, which is transformed to ES5 and will work on the front-end.
63+
When `/` is requested, you want to respond with a combination of `index.jsx` and the server-side data, and `bundle.js`. This renders the initial state of the application on the server, but allows React to run in the client to continue support state changes.
6364

6465
```
6566
app.use('/bundle.js', function (req, res) {

exercises/props/problem.en.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Modify `TodoList` in `index.jsx` like below, adding `Todo`.
1313
Before you start, you may want to check your current `index.jsx` into source
1414
control, or create a new `index.jsx` for this exercise.
1515

16+
1617
```
1718
import React from 'react';
1819
@@ -44,8 +45,9 @@ class TodoForm extends React.Component {
4445
}
4546
```
4647

47-
Now at each of the "Write code here" comments, write some JSX that results in
48-
the following HTML.
48+
At the "Write code here" comment, write some JSX that results in the HTML below.
49+
The "Omitted" comments are sections that are omitted here to save space, but should
50+
remain the same as your previous solution -- don't change them.
4951

5052
Within `Todo`, you can get the value of the `title` attribute set in `TodoList`
5153
(the parent component) by using `{this.props.title}`. Likewise, you can get the

0 commit comments

Comments
 (0)