8000 add what-is-react.md and react-semantics-and-terminology.md · learnreactjs/learnreactjs@a228d59 · GitHub
[go: up one dir, main page]

Skip to content

Commit a228d59

Browse files
committed
add what-is-react.md and react-semantics-and-terminology.md
1 parent b364e88 commit a228d59

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

assets/images/react.png

44.9 KB
Loading

content/introduction/what-is-react.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# What is React?
2+
3+
React is a UI library developed at Facebook to facilitate the creation of interactive, stateful and reusable UI components. It is used at Facebook in production, and Instagram is written in React.
4+
5+
One of it's unique points is that not only does it perform on the client side, but it can also be rendered server side, and they can work together inter-operably.
6+
7+
8+
![React](/assets/images/react.png)
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# React Semantics/Terminology
2+
3+
Below I list the most common terms, and their definitions, used when talking about React.
4+
5+
## Babel
6+
7+
[Babel](https://babeljs.io) transforms JavaScript ES* (i.e., JS 2016, 2016, 2017) to ES5. Babel is the tool of choice from the React team for writing future ES* code and transforming JSX to ES5 code.
8+
9+
## Babel CLI
10+
11+
Babel comes with a CLI tool, called [Babel CLI](https://babeljs.io/docs/usage/cli), that can be used to compile files from the command line.
12+
13+
## Component Configuration Options
14+
15+
The configuration arguments passed (as an object) to the `createReactClass()` function resulting in an instance of a React component.
16+
17+
## Component Life Cycle Methods
18+
19+
A sub group of component events, semantically separated from the other component configuration options (i.e. `componentWillUnmount`, `componentDidUpdate`, `componentWillUpdate`, `shouldComponentUpdate`, `componentWillReceiveProps`, `componentDidMount`, `componentWillMount`). These methods are executed at specific points in a component's existence.
20+
21+
## DOM
22+
23+
"The Document Object Model (DOM) is a programming interface for HTML, XML and SVG documents. It provides a structured representation of the document as a tree. The DOM defines methods that allow access to the tree, so that they can change the document structure, style and content. The DOM provides a representation of the document as a structured group of nodes and objects, possessing various properties and methods. Nodes can also have event handlers attached to them, and once an event is triggered, the event handlers get executed. Essentially, it connects web pages to scripts or programming languages." - [MSD](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model)
24+
25+
## ES5
26+
27+
The 5th edition of the ECMAScript standard. The [ECMAScript 5.1 edition](https://www.ecma-international.org/ecma-262/5.1/) was finalized in June 2011.
28+
29+
## ES6/ES 2015
30+
31+
The 6th edition of the ECMAScript standard, JavaScript 2015 or ECMAScript 2015. The [ECMAScript 6th edition](http://www.ecma-international.org/ecma-262/6.0/index.html) was finalized in June 2015.
32+
33+
## ECMAScript 2016 (ES7)
34+
35+
The 7th edition of the ECMAScript standard. The [ECMAScript 7th edition](http://www.ecma-international.org/ecma-262/7.0/index.html) was finalized in June 2016.
36+
37+
## ES*
38+
39+
Used to represent the current version of JavaScript as well as potential future versions that can written today using tools like Babel. When you see "ES*" it more than likely means you'll find uses of ES5, ES6, and ES7 together.
40+
41+
## JSX
42+
43+
[JSX](https://jsx.github.io) is an optional XML-like syntax extension to ECMAScript that can be used to define an HTML-like tree structure in a JavaScript file. The JSX expressions in a JavaScript file must be transformed to JavaScript syntax before a JavaScript engine can parse the file. Babel is typically used and recommended for transforming JSX expressions.+
44+
45+
## Node.js
46+
47+
[Node.js](https://nodejs.org/en) is an open-source, cross-platform runtime environment for writing JavaScript. The runtime environment interprets JavaScript using [Google's V8 JavaScript engine](https://developers.google.com/v8/).
48+
49+
## npm
50+
51+
[npm](https://www.npmjs.com) is the package manager for JavaScript born from the Node.js community.
52+
53+
## React Attributes/Props
54+
55+
In one sense you can think of props as the configuration options for React nodes and in another sense you can think of them as HTML attributes.
56+
57+
Props take on several roles:
58+
59+
* Props can become HTML attributes. If a prop matches a known HTML attribute then it will be added to the final HTML element in the DOM.
60+
61+
* Props passed to `createElement()` become values stored in a `prop` object as an instance property of `createReactClass()` instances (i.e., `[INSTANCE].props.[NAME OF PROP]`). Props by and large are used to input values into components.
62+
63+
* A few special props have side effects (e.g., `key`, `ref`, and `dangerouslySetInnerHTML`).
64+
65+
## React
66+
67+
[React](https://reactjs.org) is a UI library developed at Facebook to facilitate the creation of interactive, stateful, reusable UI components and flexible user interfaces.
68+
69+
## React Component
70+
71+
A React component is created by calling `createReactClass()` (or, React.Component if using ES6 classes). This function takes an object of options that is used to configure and create a React component. The most common configuration option is the render function which returns React nodes. Thus, you can think of a React component as an abstraction containing one or more React nodes/components.
72+
73+
## React Element Nodes ()
74+
75+
An HTML or custom HTML element node representation in the Virtual DOM created using `React.createElement()`.
76+
77+
## React Nodes
78+
79+
React nodes (i.e., element and text nodes) are the primary object type in React and can be created using `React.createElement('div')`. In other words React nodes are objects that represent DOM nodes and children DOM nodes. They are a light, stateless, immutable, virtual representation of a DOM node.
80+
81+
## React Node Factories
82+
83+
A function that generates a React element node with a particular type property.
84+
85+
## React Stateless Function Component
86+
87+
When a component is purely a result of props alone, no state, the component can be written as a pure function avoiding the need to create a React component instance.
88+
89+
```
90+
var MyComponent = function(props){
91+
return <div>Hello {props.name}</div>;
92+
};
93+
94+
ReactDOM.render(<MyComponent name="Brian" />, app);
95+
```
96+
97+
## React Text Nodes (ReactText)
98+
99+
A text node representation in the Virtual DOM created using `React.createElement('div', null, 'a text node');`.
100+
101+
102+
## Virtual DOM
103+
104+
An in-memory JavaScript tree of React elements/components that is used for efficient re-rendering (i.e., diffing via JavaScript) of the browser DOM.
105+
106+
## Webpack
107+
108+
[Webpack](https://webpack.github.io) is a module loader and bundler that takes modules (.js, .css, .txt, etc.) with dependencies and generates static assets representing these modules.

0 commit comments

Comments
 (0)
0