[Docs] Fix typos + add context in Step 1-06 and 2-01 READMEs (#65)

* Update docs in Step 1-06

* Fix broken link in Step 2-01

* Add more context to Step 2-01 demo docs
This commit is contained in:
Ronald Martin
2019-03-04 14:26:42 -08:00
committed by Kenneth Chau
parent 44682dac81
commit cbecd133ac
2 changed files with 6 additions and 6 deletions

View File

@@ -122,4 +122,4 @@ With those two pieces in place, we can update our uncontrolled input to being co
<input value={this.state.labelInput} onChange={this._onChange} className="textfield" placeholder="add todo" />
```
> If you have React Dev Tools installed, open them up and take a look at labelInput as we type in the input.
> If you have React Dev Tools installed, open them up and take a look at `labelInput` as we type in the input.

View File

@@ -30,13 +30,13 @@ The most important ones to know about are:
## TypeScript Types
Refer to [`demo/src`](./demo/src) for examples of some of the types available in TS that benefit a React developer.
Refer to [`demo/src/types`](./src/types/index.ts) for examples of some of the types available in TS that benefit a React developer.
## Spread Operator
The spread operator `...` provides a quick way to clone and concatenate objects and arrays. This syntax is seen a lot inside React props and Redux reducers.
With objects:
With **objects**:
```ts
// Shallow copy an object
@@ -52,7 +52,7 @@ const cloned2 = { ...obj1, ...obj2, key: value };
const overridden = { ...object, [key + '-suffix']: value };
```
With arrays:
With **arrays**:
```ts
const copy1 = [...arr];
@@ -107,7 +107,7 @@ const [foo, ...bar] = arr;
## Promise
A promise is an object representing work that will be completed later, asynchronously. Promises are chainable, which helps with writing maintainable async code. (Typically, legacy async code uses callbacks to let the caller have control over what to do after the task has been completed, which becomes very hard to read.)
A promise is an object representing work that will be completed later, asynchronously. Promises are chainable, which helps with writing maintainable async code. (Typically, legacy async code uses callbacks to let the caller have control over what to do after the task has been completed, which becomes [very hard to read](http://callbackhell.com/).)
```ts
const aPromise = new Promise((resolve, reject) => {
@@ -141,7 +141,7 @@ aPromise
## Async / Await
This syntax is inspired heavily by C#'s async / await syntax. An async function is written like this:
**Async / Await** is a language-level feature for writing asynchronous functions as if they are ordinary, synchronous code. JS support for this is built on top of `Promise`s and is inspired heavily by [C#'s async / await syntax](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/). An async function is written like this:
```ts
async function someFunctionAsync() {