Skip to content

Commit 27accdb

Browse files
update assumptions section to add ES6 code examples
1 parent 4cdaab0 commit 27accdb

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,48 @@
44
55
— Facebook (the creators/maintainers of this thing)
66

7+
---
8+
79
## Assumptions
810

9-
This assumes you already are familiar with ES6, especially arrow functions, const vs let, and object destructuring.
11+
This assumes you already are familiar with ES6, especially ...
12+
13+
- Variable declaration with `const` and `let`
14+
- Arrow functions `const getRandomBool = () => Math.random() >= 0.5;`
15+
- Object shorthand `const key = "value"; const obj = { key };`
16+
- Object destructuring `const { key } = obj;`
17+
- Array destructuring `const [item] = arr;`
18+
- Array spread operator `const copy = [...arr];`
19+
- .map array method `const itemNames = items.map(item => item.name);`
20+
- String template literals
21+
22+
```js
23+
// variable declaration with const or let
24+
const dontChangeMyType = 1;
25+
let goAheadChangeMe = 1;
26+
goAheadChangeMe = false;
27+
// object shorthand
28+
const key = "value";
29+
const obj = { key };
30+
// object destructuring
31+
const object = { keyName: "val" };
32+
const { keyName } = object;
33+
// arrow functions
34+
const getRandomBool = () => Math.random() >= 0.5;
35+
// array spread operator
36+
const arr = [{ name: "Steve" }, { name: "Alicia" }];
37+
const people = [...arr, { name: "Bob" }];
38+
// .map array method
39+
const names = people.map(person => person.name);
40+
// array destructuring
41+
const [steve, alicia, bob] = names;
42+
// string template literals
43+
const greeting = `Hey, ${steve}!`;
44+
```
45+
46+
---
1047

11-
## What is it?
48+
## What is React?
1249

1350
React allows you to build an app interface out of a composition of **components** (written in **JSX**).
1451

0 commit comments

Comments
 (0)