Skip to content

Commit ef4c2a8

Browse files
Formatting updates
This is a first round of suggested edits. What’s in this PR: First, there are no actual changes to content, only to the presentation of the content, adopting patterns to improve consistency and readability. 1) Adopted pattern to use title-casing (AP style) 2) Adopted pattern to use punctuation with abbreviations, ex: e.g., i.e., a.k.a., etc. (AP style) 3) Adopted pattern to use “>” before any source code links, which will indent and block quote that link
1 parent fc19809 commit ef4c2a8

36 files changed

+210
-210
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
Written by [Cody Lindley](http://codylindley.com/) sponsored by — [Frontend Masters](https://frontendmasters.com/)
44

5-
Learn React in the terse cookbook style found with previous Enlightenment titles (i.e. [jQuery Enlightenment](http://jqueryenlightenment.com/), [JavaScript Enlightenment](http://javascriptenlightenment.com/), [DOM Enlightenment](http://domenlightenment.com/))
5+
Learn React in the terse cookbook style found with previous Enlightenment titles (i.e., [jQuery Enlightenment](http://jqueryenlightenment.com/), [JavaScript Enlightenment](http://javascriptenlightenment.com/), [DOM Enlightenment](http://domenlightenment.com/))
66

77
***
88

9-
**download a .pdf, .epub, or .mobi file from**:
9+
**Download a .pdf, .epub, or .mobi file from**:
1010

1111
* [https://www.gitbook.com/book/frontendmasters/react-enlightenment/details](https://www.gitbook.com/book/frontendmasters/react-enlightenment/details)
1212

13-
**contribute content, suggestions, and fixes on github**:
13+
**Contribute content, suggestions, and fixes on GitHub**:
1414

1515
* [https://github.com/FrontendMasters/react-enlightenment](https://github.com/FrontendMasters/react-enlightenment)
1616

SUMMARY-proposal.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# Summary
22

3-
* [What is React](what-is-react.md)
4-
* [React semantics/terminology](react-semantics.md)
5-
* [React & Babel basic setup](react-basic-setup.md)
3+
* [What Is React](what-is-react.md)
4+
* [React Semantics/terminology](react-semantics.md)
5+
* [React & Babel Basic Setup](react-basic-setup.md)
66
* [Using react.js & react-dom.js](react-basic-setup/1.1.md)
77
* [Using JSX via Babel](react-basic-setup/1.2.md)
8-
* [Using ES6 & ES* with React](react-basic-setup/1.3.md)
9-
* [Writing React with JSFiddle](react-basic-setup/1.4.md)
8+
* [Using ES6 & ES* With React](react-basic-setup/1.3.md)
9+
* [Writing React With JSFiddle](react-basic-setup/1.4.md)
1010
* [React Nodes](react-nodes.md)
11-
* [What is a React node?](react-nodes/2.1.md)
12-
* [Creating React nodes](react-nodes/2.2.md)
13-
* [Defining React node attributes (aka props)](react-nodes/2.3.md)
14-
* [Using React node element factories](react-nodes/2.4.md)
11+
* [What Is a React Node?](react-nodes/2.1.md)
12+
* [Creating React Nodes](react-nodes/2.2.md)
13+
* [Defining React Node Attributes (a.k.a, Props)](react-nodes/2.3.md)
14+
* [Using React Node Element Factories](react-nodes/2.4.md)
1515
* [JSX](react-jsx.md)
16-
* [What is a JSX?](react-jsx/3.1.md)
17-
* [Using JSX to create React nodes](react-jsx/3.2.md)
16+
* [What Is a JSX?](react-jsx/3.1.md)
17+
* [Using JSX to Create React Nodes](react-jsx/3.2.md)
1818
* [React Components]()
1919
* [React DOM Rendering]()
2020
* [React Props]()
2121
* [React State]()
2222
* [React ???]()
23-
* [Creating React elements]()
23+
* [Creating React Elements]()
2424
* [Creating JSX]()
2525
* [Writing JavaScript in JSX]()
26-
* [Creating React components]()
27-
* [Referencing component in JSX]()
28-
* [Rendering using Virtual DOM]()
29-
* [Creating child components]()
30-
* [Passing values to components using props]()
31-
* [Storing dynamic data in a component using state]()
32-
* [React & Babel advanced setup](react-advanced-setup.md)
26+
* [Creating React Components]()
27+
* [Referencing Component in JSX]()
28+
* [Rendering Using Virtual DOM]()
29+
* [Creating Child Components]()
30+
* [Passing Values to Components Using Props]()
31+
* [Storing Dynamic Data in a Component Using State]()
32+
* [React & Babel Advanced Setup](react-advanced-setup.md)
3333
* [Babel/JSX via CLI](react-advanced-setup/2.1.md)
3434
* [Babel/JSX via SystemJS](react-advanced-setup/2.2.md)
35-
* [Babel/JSX via webpack](react-advanced-setup/2.3.md)
35+
* [Babel/JSX via Webpack](react-advanced-setup/2.3.md)
3636
* [React Developer Tools ](react-advanced-setup/2.4.md
3737

3838

@@ -49,7 +49,7 @@
4949

5050
* React namespace
5151
* React.createClass (define react component using JSX)
52-
* React.createElement (create react elements / i.e. DOM)
52+
* React.createElement (create react elements / i.e., DOM)
5353
* ReactDOM.render (place react elements into actual DOM via virtual DOM)
5454
* Using {} in JSX
5555
* Props (how data is passed down the tree via attributes and child nodes)
@@ -58,7 +58,7 @@
5858

5959
* Custom elements
6060
* Composable Components / tree of components / component hierarchy
61-
* Controller components i.e. top-level branch components
61+
* Controller components i.e., top-level branch components
6262
* JSX (an XML’ish like HTML written in JS)
6363
* Virtual DOM
6464
* React is safe. We are not generating HTML strings so XSS protection is the default.

SUMMARY.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
# Summary
22

3-
* [What is React](what-is-react.md)
4-
* [React semantics/terminology](react-semantics.md)
5-
* [React & Babel basic setup](react-basic-setup.md)
3+
* [What Is React](what-is-react.md)
4+
* [React Semantics/Terminology](react-semantics.md)
5+
* [React & Babel Basic Setup](react-basic-setup.md)
66
* [Using react.js & react-dom.js](react-basic-setup/3.1.md)
77
* [Using JSX via Babel](react-basic-setup/3.2.md)
88
* [Using ES6 & ES* with React](react-basic-setup/3.3.md)
9-
* [Writing React with JSFiddle](react-basic-setup/3.4.md)
10-
* [React nodes](react-nodes.md)
11-
* [What is a React node?](react-nodes/4.1.md)
12-
* [Creating React nodes](react-nodes/4.4.md)
9+
* [Writing React With JSFiddle](react-basic-setup/3.4.md)
10+
* [React Nodes](react-nodes.md)
11+
* [What Is a React Node?](react-nodes/4.1.md)
12+
* [Creating React Nodes](react-nodes/4.4.md)
1313
* [Rendering to DOM](react-nodes/4.3.md)
14-
* [Defining attributes/props](react-nodes/4.4.md)
15-
* [Inlining CSS on element nodes](react-nodes/4.5.md)
16-
* [Using element factories](react-nodes/4.6.md)
17-
* [JavaScript syntax extension (aka JSX)](react-jsx.md)
18-
* [What is a JSX?](react-jsx/5.1.md)
19-
* [Creating React nodes with JSX](react-jsx/5.2.md)
14+
* [Defining Attributes/Props](react-nodes/4.4.md)
15+
* [Inlining CSS on Element Nodes](react-nodes/4.5.md)
16+
* [Using Element Factories](react-nodes/4.6.md)
17+
* [JavaScript Syntax Extension (a.k.a., JSX)](react-jsx.md)
18+
* [What Is a JSX?](react-jsx/5.1.md)
19+
* [Creating React Nodes With JSX](react-jsx/5.2.md)
2020
* [Rendering JSX to DOM](react-jsx/5.5.md)
21-
* [Using JS expressions in JSX](react-jsx/5.4.md)
22-
* [Using JS comments in JSX](react-jsx/5.5.md)
23-
* [Using inline CSS in JSX](react-jsx/5.6.md)
24-
* [Defining JSX attributes/props](react-jsx/5.7.md)
25-
* [Basic React components](basic-react-components.md)
26-
* [What is a React component?](basic-react-components/6.1.md)
27-
* [Creating components](basic-react-components/6.2.md)
28-
* [Return one starting node/component](basic-react-components/6.3.md)
29-
* [Creating stateless function components](basic-react-components/6.4.md)
30-
* [Referring to a component instance](basic-react-components/6.5.md)
21+
* [Using JS Expressions in JSX](react-jsx/5.4.md)
22+
* [Using JS Comments in JSX](react-jsx/5.5.md)
23+
* [Using Inline CSS in JSX](react-jsx/5.6.md)
24+
* [Defining JSX Attributes/Props](react-jsx/5.7.md)
25+
* [Basic React Components](basic-react-components.md)
26+
* [What Is a React Component?](basic-react-components/6.1.md)
27+
* [Creating Components](basic-react-components/6.2.md)
28+
* [Return One Starting Node/Component](basic-react-components/6.3.md)
29+
* [Creating Stateless Function Components](basic-react-components/6.4.md)
30+
* [Referring to a Component Instance](basic-react-components/6.5.md)
3131
* [React Props](react-props.md)
32-
* [What are props?](react-props/7.1.md)
33-
* [Setting props](react-props/7.2.md)
34-
* [Getting props](react-props/7.3.md)
35-
* [Setting default props](react-props/7.4.md)
36-
* [Validating props](react-props/7.5.md)
37-
* [Props more than strings](react-props/7.6.md)
38-
* [Transferring props](react-props/7.7.md)
32+
* [What Are Props?](react-props/7.1.md)
33+
* [Setting Props](react-props/7.2.md)
34+
* [Getting Props](react-props/7.3.md)
35+
* [Setting Default Props](react-props/7.4.md)
36+
* [Validating Props](react-props/7.5.md)
37+
* [Props More Than Strings](react-props/7.6.md)
38+
* [Transferring Props](react-props/7.7.md)
3939
* [React State](react-state/react-state.md)
40-
* [What is state?](react-state/8.1.md)
41-
* [Setting state](react-state/8.2.md)
42-
* [Getting state](react-state/8.3.md)
43-
* [Setting initial state](react-state/8.4.md)
44-
* [state v.s. props](react-state/8.5.md)
40+
* [What Is State?](react-state/8.1.md)
41+
* [Setting State](react-state/8.2.md)
42+
* [Getting State](react-state/8.3.md)
43+
* [Setting Initial State](react-state/8.4.md)
44+
* [State vs. Props](react-state/8.5.md)
4545
* [Advanced React components](advanced-react-components.md)

basic-react-components/6.1.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# What is a React component?
1+
# What Is a React Component?
22

33
The next section will provide a mental model around the nature of a React component and cover details around creating React components.
44

5-
Typically a single view of a user interface (e.g. the tree) is divided up into logical chunks (e.g. branches). The tree becomes the starting component (e.g. a layout component) and then each chunk in the UI will become a sub-component that can be divided further into sub components (i.e. sub-branches). This not only keeps the UI organized but it also allows data and state changes to logically flow from the tree, to branches, then sub branches.
5+
Typically a single view of a user interface (e.g., the tree) is divided up into logical chunks (e.g., branches). The tree becomes the starting component (e.g., a layout component) and then each chunk in the UI will become a sub-component that can be divided further into sub components (i.e., sub-branches). This not only keeps the UI organized but it also allows data and state changes to logically flow from the tree, to branches, then sub branches.
66

7-
If this description of React components is cryptic then I would suggest that you examine any application interface and mentally start dividing the UI into logical chunks. Those chunks potentially are components. React components are the programatic abstraction (i.e. events, state changes, DOM changes) making it possible to literally create these chunks and sub-chunks. For example, a lot of application UI's will have a layout component as the top component in a UI view. This component will contain several sub-components, like maybe, a search component or a menu component. The search component can then be divided further into sub-components. Maybe the search input is a separate component from the button that invokes the search. As you can see, a UI can quickly become a tree of components. Today, software UI's are typically created by crafting a tree of very simple [single responsibility](https://en.wikipedia.org/wiki/Single_responsibility_principle) components. React provides the means to create these components via the `React.createClass()` function (or, `React.Component` if using ES6 classes). The `React.createClass()` function takes in a configuration object and returns a React component instance.
7+
If this description of React components is cryptic then I would suggest that you examine any application interface and mentally start dividing the UI into logical chunks. Those chunks potentially are components. React components are the programatic abstraction (i.e., events, state changes, DOM changes) making it possible to literally create these chunks and sub-chunks. For example, a lot of application UI's will have a layout component as the top component in a UI view. This component will contain several sub-components, like maybe, a search component or a menu component. The search component can then be divided further into sub-components. Maybe the search input is a separate component from the button that invokes the search. As you can see, a UI can quickly become a tree of components. Today, software UI's are typically created by crafting a tree of very simple [single responsibility](https://en.wikipedia.org/wiki/Single_responsibility_principle) components. React provides the means to create these components via the `React.createClass()` function (or, `React.Component` if using ES6 classes). The `React.createClass()` function takes in a configuration object and returns a React component instance.
88

9-
A React component is basically any part of a UI that can contain React nodes (via `React.createElement()` or JSX). I spent a lot of time up front talking about React nodes so that the ingredients of a React component would be firmly understood. Sounds simple until one realizes that React components can contained other React sub-components which can result in a complex tree of components. This is not unlike the idea that React nodes can contain other React nodes in a Virtual DOM. It might hurt your brain, but if you think hard about it all a component does it wraps itself around a logical set of branches from a tree of nodes. In this sense, you define an entire UI from components using React but the result is a tree of React nodes that can easily be translated to something like an HTML document (i.e. tree of DOM nodes).
9+
A React component is basically any part of a UI that can contain React nodes (via `React.createElement()` or JSX). I spent a lot of time up front talking about React nodes so that the ingredients of a React component would be firmly understood. Sounds simple until one realizes that React components can contained other React sub-components which can result in a complex tree of components. This is not unlike the idea that React nodes can contain other React nodes in a Virtual DOM. It might hurt your brain, but if you think hard about it all a component does it wraps itself around a logical set of branches from a tree of nodes. In this sense, you define an entire UI from components using React but the result is a tree of React nodes that can easily be translated to something like an HTML document (i.e., tree of DOM nodes).

basic-react-components/6.2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Creating React components
22

3-
A React component that will potentially contain `state` can be created by calling the `React.createClass()` function. This function takes one argument object used to specify the details of the component. The available component configuration options are listed below (aka component specifications).
3+
A React component that will potentially contain `state` can be created by calling the `React.createClass()` function. This function takes one argument object used to specify the details of the component. The available component configuration options are listed below (a.k.a., component specifications).
44

55
<table>
66
<tr>
@@ -80,7 +80,7 @@ The following code is an example of creating a `Timer` React component from Reac
8080

8181
Make sure you read the comments in the code.
8282

83-
[source code](https://jsfiddle.net/12u58fjb/#tabs=js,result,html,resources)
83+
> [source code](https://jsfiddle.net/12u58fjb/#tabs=js,result,html,resources)
8484
8585
It might look like a lot of code but all that is going on is passing the createClass function a configuration object containing 5 properties (`getInitialState`, `tick`, `componentDidMount`, `componentWillUnmount`, `render`).
8686

basic-react-components/6.3.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Components return one node/component
1+
# Components Return One Node/Component
22

33
The `render` configuration value defined when creating a component should return only one React node (or, component). This one node/component can contained any number of children. In the code below the `<reactNode>` is the starting node. In side of this node any number of sibling and child nodes can be returned.
44

5-
[source code](https://jsfiddle.net/fv26rjdL/#tabs=js,result,html,resources)
5+
> [source code](https://jsfiddle.net/fv26rjdL/#tabs=js,result,html,resources)
66
77
Note that if you want to return React nodes on more than one line (taking advantage of whitespace) you will have to surround the returned value in `()`.
88

9-
[source code](https://jsfiddle.net/e2awasnk/#tabs=js,result,html,resources)
9+
> [source code](https://jsfiddle.net/e2awasnk/#tabs=js,result,html,resources)
1010
1111
An error will occur if more than one starting React node is attempted to be return. If you think about it, the error occurs because returning two `React.createElement()` functions isn't possible with JavaScript.
1212

13-
[source code](https://jsfiddle.net/xe5kkpub/#tabs=js,result,html,resources)
13+
> [source code](https://jsfiddle.net/xe5kkpub/#tabs=js,result,html,resources)
1414
1515
Thus, the above code will result in the following error:
1616

@@ -29,11 +29,11 @@ Commonly, developers will add a wrapping element `<div>` element to avoid this e
2929

3030
This issue also concerns components. Just like React nodes, if you are returning a component, only one starting component can be returned but that component can have unlimited children.
3131

32-
[source code](https://jsfiddle.net/o0fqta42/#tabs=js,result,html,resources)
32+
> [source code](https://jsfiddle.net/o0fqta42/#tabs=js,result,html,resources)
3333
3434
If you return two sibling components, the same error will occur.
3535

36-
[source code](https://jsfiddle.net/3968zzv3/#tabs=js,result,html,resources)
36+
> [source code](https://jsfiddle.net/3968zzv3/#tabs=js,result,html,resources)
3737
3838
```
3939
VM7370 babel.js:62789 Uncaught SyntaxError: embedded: Adjacent JSX elements must be wrapped in an enclosing tag (10:2)

basic-react-components/6.4.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Creating stateless function components
1+
# Creating Stateless Function Components
22

33
When a component is purely a result of `props` alone the component can be written as a pure function avoiding the need to create a React component instance.
44

5-
[source code](https://jsfiddle.net/5nzpxyuu/#tabs=js,result,html,resources)
5+
> [source code](https://jsfiddle.net/5nzpxyuu/#tabs=js,result,html,resources)
66
77
This is typically referred to as a stateless function component.
88

9-
Stateless function components can't be passed component options (i.e. `render`, `componentWillUnmount`, etc..). However `.propTypes` and `.defaultProps` can be set as properties on the function.
9+
Stateless function components can't be passed component options (i.e., `render`, `componentWillUnmount`, etc.). However `.propTypes` and `.defaultProps` can be set as properties on the function.
1010

1111
The code example below demonstrates a stateless function component making use of `.propTypes` and `.defaultProps`.
1212

13-
[source code](https://jsfiddle.net/tpvjyp34/#tabs=js,result,html,resources)
13+
> [source code](https://jsfiddle.net/tpvjyp34/#tabs=js,result,html,resources)

basic-react-components/6.5.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Referring to a component instance
1+
# Referring to a Component Instance
22

3-
When a component is `render`'ed', a React component instance is created from the passed configuration options. One can gain access to this instance and it's properties (e.g. `this.props`) and methods (e.g. `this.setState`) in two ways.
3+
When a component is `render`'ed', a React component instance is created from the passed configuration options. One can gain access to this instance and it's properties (e.g., `this.props`) and methods (e.g., `this.setState`) in two ways.
44

55
The first way is by using the `this` keyword from within a configuration function option. In the code example below all of the `console.log(this)` statements will refer to the component instance.
66

7-
[source code](https://jsfiddle.net/codylindley/xkz0ph2d/4/#tabs=js,result,html,resources)
7+
> [source code](https://jsfiddle.net/codylindley/xkz0ph2d/4/#tabs=js,result,html,resources)
88
99
The other way to gain a reference to a component instance involves making use of the return value from calling `ReactDOM.render()`. In other words, the `ReactDOM.render()` function will return a reference to the top most rendered component.
1010

11-
[source code](https://jsfiddle.net/codylindley/vavk9b5t/2/#tabs=js,result,html,resources)
11+
> [source code](https://jsfiddle.net/codylindley/vavk9b5t/2/#tabs=js,result,html,resources)
1212
1313
#### Notes
1414

myIntro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# React Enlightenment [DRAFT]
22

3-
Learn React in the terse cookbook style found with previous Enlightenment titles (i.e. [jQuery Enlightenment](http://jqueryenlightenment.com/), [JavaScript Enlightenment](http://javascriptenlightenment.com/), [DOM Enlightenment](http://domenlightenment.com/))
3+
Learn React in the terse cookbook style found with previous Enlightenment titles (i.e., [jQuery Enlightenment](http://jqueryenlightenment.com/), [JavaScript Enlightenment](http://javascriptenlightenment.com/), [DOM Enlightenment](http://domenlightenment.com/))
44

55
***
66

react-advanced-setup/2.1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
## title
1+
# Title [Use Title-Casing]
22

3-
### sub
3+
## Sub [Use Title-Casing]

0 commit comments

Comments
 (0)