Skip to content

Commit 9cbc95b

Browse files
committed
update
0 parents  commit 9cbc95b

File tree

603 files changed

+211812
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

603 files changed

+211812
-0
lines changed

learn-react-master/.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# Compiled binary addons (http://nodejs.org/api/addons.html)
20+
build/Release
21+
22+
# Dependency directory
23+
# Commenting this out is preferred by some people, see
24+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
25+
node_modules
26+
27+
# Users Environment Variables
28+
.lock-wscript

learn-react-master/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
![React Intro](http://i.imgur.com/yH3JkIH.png)
2+
3+
Learn React.js for *high performance* JavaScript applications.
4+
5+
## Start
6+
7+
- Getting started: http://facebook.github.io/react/docs/getting-started.html
8+
(recommends using [JSX](http://jsx.github.io) which is quite bleeding-edge)
9+
- Tutorial: http://facebook.github.io/react/docs/tutorial.html
10+
11+
12+
## Background
13+
14+
React is a JavaScript library for building user interfaces.
15+
16+
+ **Just the UI:** Lots of people use React as the V in MVC.
17+
Since React makes no assumptions about the rest of your technology stack,
18+
it's easy to try it out on a small feature in an existing project.
19+
+ **Virtual DOM:** React uses a *virtual DOM* diff implementation
20+
for ultra-high performance. It can also render on the server using
21+
Node.js — no heavy browser DOM required.
22+
* This means that every time something changes, React creates a _virtual_ DOM tree, checks for the differences between that and the existing DOM and then re-renders **only the differences** to the DOM
23+
+ **Data flow:** React implements one-way reactive data flow which reduces
24+
boilerplate and is easier to reason about than traditional data binding.
25+
26+
27+
### Reading
28+
29+
+ Main Site: http://facebook.github.io/react/
30+
+ Getting Started: http://facebook.github.io/react/docs/getting-started.html
31+
+ Thinking in React: http://facebook.github.io/react/docs/thinking-in-react.html
32+
+ Overview (Flux): http://facebook.github.io/flux/docs/overview.html
33+
+ GitHub: https://github.com/facebook/react
34+
35+
### Video
36+
37+
+ *Introduction* to React.js: https://www.youtube.com/watch?v=XxVg_s8xAms
38+
+ *Thinking* in React: http://tagtree.tv/thinking-in-react (click "maybe later" for video to start)
39+
+ Main List: https://facebook.github.io/react/docs/videos.html
40+
+ Building UIs with ReactJS: http://youtu.be/lAn7GVoGlKU?t=51s
41+
+ *High performance* functional programming with **React** *and* **Meteor**:
42+
https://www.youtube.com/watch?v=qqVbr_LaCIo
43+
+ React's Architecture: https://www.youtube.com/watch?v=eCf5CquV_Bw
44+
+ Getting Started with React.js: ~~ https://www.youtube.com/watch?v=6ho8aOPUYxs ~~
45+
http://code.tutsplus.com/courses/getting-started-with-reactjs
46+
(I Paid the $15 for the course - let me know if you need access)
47+
48+
49+
50+
## What?
51+
52+
react.min.js (minified!) is ***124kb***!
53+
see: http://facebook.github.io/react/downloads.html
54+
specifically: http://fb.me/react-0.11.2.min.js
55+
56+
### Resources
57+
58+
- Great list of React.js resources: https://github.com/enaqx/awesome-react
59+
60+
### Components not Templates
61+
62+
> http://css-tricks.com/modular-future-web-components
63+
64+
### Server-Side Rendering
65+
66+
+ https://www.npmjs.com/package/react-server-example
67+
+ http://maketea.co.uk/2014/06/30/building-robust-web-apps-with-react-part-4.html
68+
69+
70+
## Testing with JEST
71+
72+
+ GitHub Repo for Jest CLI: https://github.com/facebook/jest
73+
+ Get Started: http://facebook.github.io/jest/docs/getting-started.html
74+
+ Tutorial: https://facebook.github.io/jest/docs/tutorial.html
75+
+ API: https://facebook.github.io/jest/docs/api.html
76+
+ Testing Flux Apps: http://facebook.github.io/react/blog/2014/09/24/testing-flux-applications.html
77+
78+
### Test Coverage
79+
80+
+ http://stackoverflow.com/questions/28283371/how-to-get-test-coverage-from-jest-while-testing-react-js-app
81+
82+
## React Native
83+
84+
- React.js Conf 2015 Keynote: http://youtu.be/KVZ-P-ZI6W4

learn-react-master/index.html

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset=utf-9>
5+
<title>First Component</title>
6+
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
7+
</head>
8+
<body>
9+
10+
<!-- container node -->
11+
<div id="app"></div>
12+
13+
<script src="http://fb.me/react-0.12.2.js"></script>
14+
<script src="http://fb.me/JSXTransformer-0.12.2.js"></script>
15+
<script type="text/jsx">
16+
/** @jsx React.DOM */
17+
18+
var MessageBox = React.createClass({
19+
20+
handleAdd: function(e){
21+
console.log(this);
22+
var newMessage = this.refs.newMessage.getDOMNode().value;
23+
var newMessages = this.state.messages.concat([newMessage]);
24+
this.setState({
25+
messages: newMessages
26+
});
27+
},
28+
29+
getInitialState: function() {
30+
return {
31+
isVisible: true,
32+
messages: [
33+
'I like the world',
34+
'Coffee flavored ice cream is highly underrated',
35+
'My spoon is too big',
36+
'Tuesday is coming. Did you bring your coat?',
37+
'I am a banana'
38+
]
39+
}
40+
},
41+
42+
render: function() {
43+
44+
var inlineStyles = {
45+
display: this.state.isVisible ? 'block' : 'none'
46+
};
47+
48+
var messages = this.state.messages.map(function(message) {
49+
return <SubMessage message={message} />
50+
})
51+
52+
return (
53+
<div className="container jumbotron" style={inlineStyles}>
54+
<h2>Hello, World</h2>
55+
<input ref="newMessage" type="text" />
56+
<button className="btn btn-primary" onClick={this.handleAdd}>Add</button>
57+
{ messages }
58+
</div>
59+
);
60+
}
61+
});
62+
63+
var SubMessage = React.createClass({
64+
handleDelete: function(e) {
65+
66+
},
67+
68+
propTypes: function() {
69+
message: React.PropTypes.string.isRequired
70+
},
71+
72+
getDefaultProps: function () {
73+
return {
74+
message: "Its good to see you"
75+
}
76+
},
77+
78+
render: function() {
79+
return (
80+
<div>{this.props.message}</div>
81+
)
82+
}
83+
});
84+
85+
var reactComponent = React.render(
86+
<MessageBox />,
87+
document.getElementById('app'),
88+
function after() {
89+
console.log('hai after render!');
90+
}
91+
)
92+
93+
</script>
94+
</body>
95+
</html>

learn-react-master/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "learn-react",
3+
"version": "1.0.0",
4+
"description": "learn how to use react.js for full-stack JS apps",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "https://github.com/nelsonic/learn-react.git"
12+
},
13+
"keywords": [
14+
"react.js",
15+
"full-stack"
16+
],
17+
"author": "@nelsonic <contact.nelsonic@gmail.com> (https://github.com/nelsonic)",
18+
"license": "ISC",
19+
"bugs": {
20+
"url": "https://github.com/nelsonic/learn-react/issues"
21+
},
22+
"homepage": "https://github.com/nelsonic/learn-react",
23+
"dependencies": {
24+
"react": "^0.12.2"
25+
}
26+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
.DS_Store
3+
.idea/
4+
5+
jest
6+
7+
chapter-12/color-organizer/dist/
8+
9+
# Logs
10+
logs
11+
*.log
12+
npm-debug.log*
13+
14+
# Runtime data
15+
pids
16+
*.pid
17+
*.seed
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons (http://nodejs.org/api/addons.html)
35+
build/Release
36+
37+
# Dependency directories
38+
node_modules
39+
jspm_packages
40+
41+
# Optional npm cache directory
42+
.npm
43+
44+
# Optional REPL history
45+
.node_repl_history
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Learning React: Second Edition ⚛️
2+
3+
This repository contains the files for the book _Learning React_ by [Alex Banks](https://twitter.com/moontahoe) and [Eve Porcello](https://twitter.com/eveporcello) of [Moon Highway](https://moonhighway.com).
4+
5+
| | |
6+
| ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7+
| ![Learning React Book Cover](https://raw.githubusercontent.com/MoonHighway/learning-react/second-edition/learning-react.jpg) | If you want to learn how to build efficient React applications, this is your book. This updated edition provides best practices and patterns for writing modern React code including a deep dive on React Hooks.<br><br> **Get the book**: [Amazon](https://www.amazon.com/Learning-React-Modern-Patterns-Developing/dp/1492051721) - [O'Reilly](http://shop.oreilly.com/product/0636920252894.do)<br>**Get React Training**: [Moon Highway](http://www.moonhighway.com)<br><br> |
8+
| ![Learning React Book v1](https://raw.githubusercontent.com/MoonHighway/learning-react/second-edition/learning-react-v1.jpg) | *Looking for the first edition files? Check out the [first-edition branch](https://github.com/MoonHighway/learning-react/tree/master).*|
9+
10+
> "This is the React book that’s been missing from the frontend community. Alex and Eve not only discuss React in-depth but cover foundational JavaScript concepts, testing, state management, and more. Plus, they do so with approachable language and humor. I cannot recommend Learning React highly enough." - [Emma Bostian](https://twitter.com/emmabostian), Software Engineer at Spotify
11+
12+
### Table of Contents
13+
14+
- **Chapter 1** : [Welcome To React](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-01)
15+
- **Chapter 2** : [Emerging JavaScript](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-02)
16+
- **Chapter 3** : [Functional Programming with JavaScript](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-03)
17+
- **Chapter 4** : [Pure React](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-04)
18+
- **Chapter 5** : [React with JSX](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-05)
19+
- **Chapter 6** : [React State Management](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-06)
20+
- **Chapter 7** : [Enhancing Components with Hooks](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-07)
21+
- **Chapter 8** : [Incorporating Data](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-08)
22+
- **Chapter 9** : [Suspense](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-09)
23+
- **Chapter 10** : [Testing](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-10)
24+
- **Chapter 11** : [React Router](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-11)
25+
- **Chapter 12** : [React and the Server](https://github.com/MoonHighway/learning-react/tree/second-edition/chapter-12)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Chapter 1 : Introduction
2+
3+
The widespread use of React on large websites shows that it is stable enough to use at scale. React is ready.
4+
5+
## Installing Node.js and NPM
6+
7+
When working with Node and React, you will need to use the command line. On the Mac, this is called the Terminal. On a PC,
8+
it is called the Command Prompt. Run the following commands to check your current version on node and npm. If needed,
9+
instructions on how to install or upgrade are below.
10+
11+
First, check to see if you have Node.js installed:
12+
13+
```
14+
$ node -v
15+
```
16+
17+
If this returns a version number, Node.js is installed. If the command is not found, you'll need to [install Node.js](https://nodejs.org/en/) from the Node.js website. Download the installer, run it, and follow the instructions.
18+
19+
---
20+
21+
Next, check your version of npm:
22+
23+
```
24+
$ npm -v
25+
```
26+
27+
Then, if you are running anything less than version 8, you will need to update npm:
28+
29+
### Update npm on Mac
30+
31+
```
32+
$ sudo npm update -g npm
33+
```
34+
35+
### Update npm on PC
36+
37+
Make sure to run the Command Prompt with administrator privileges:
38+
39+
```
40+
$ npm update -g npm
41+
```
42+
43+
##### Optionally install Yarn
44+
45+
Yarn is a package manager created at Facebook. It is a compatible alternative to npm. Yarn's use is not required,
46+
but you can optionally install it if you like:
47+
48+
```
49+
$ sudo npm install -g yarn
50+
```
51+
52+
Finally, there are some nice options for switching Node versions. This is not required, but you can
53+
optionally install one of these version mangers:
54+
55+
- [Install Node Version Manager - mac only (optional)](https://github.com/creationix/nvm)
56+
- [Install NVM-Windows - pc only (optional)](https://github.com/coreybutler/nvm-windows)
57+
58+
---
59+
60+
## Installing the React Tools
61+
62+
Next, install the React developer tools:
63+
64+
- Development Tools ([Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) |
65+
[Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/))
66+
67+
## Working with the Files
68+
69+
This repository links to samples hosted on various platforms, so that you can immediately begin interacting with the files. For smaller samples, we've linked to JSBins to allow you to run the sample with limited overhead. We also have links to CodeSandboxes and other repos if the samples are more in-depth.
70+
71+
## React Resources
72+
73+
Finally, we have some links to resources and official documentation for the libraries that we will be using:
74+
75+
- [React Documentation](https://facebook.github.io/react/index.html)
76+
- [React Source](https://github.com/facebook/react)
77+
- [React Blog](https://facebook.github.io/react/blog/)
78+
- [React NPM](https://www.npmjs.com/package/react)
79+
- [webpack Documentation](https://webpack.js.org/)
80+
- [Jest Documentation](https://facebook.github.io/jest/)
81+
- [React Router Documentation](https://reacttraining.com/react-router/)

0 commit comments

Comments
 (0)