From af0262935d7df80b10c958f2e1449c920024db0f Mon Sep 17 00:00:00 2001 From: webrascal Date: Thu, 7 Jan 2016 10:12:11 +1300 Subject: [PATCH 001/126] Link to `commonjs` documentation from webpack docs --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58ada5b..e95b8c4 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ I still think the easiest way to learn React is [the official tutorial](https:// ## Learning `npm` -`npm` is the Node.js package manager and is the most popular way front-end engineers and designers share JavaScript code. It includes a module system called `CommonJS` (Google it -- it’s important) and lets you install command-line tools written in JavaScript. +`npm` is the Node.js package manager and is the most popular way front-end engineers and designers share JavaScript code. It includes a module system called `CommonJS` ([read up on it](https://webpack.github.io/docs/commonjs.html) -- it’s important) and lets you install command-line tools written in JavaScript. Most reusable components, libraries and tools in the React ecosystem are available as `CommonJS` modules and are installed with `npm`. From 6daf8d328d95502964fa70c7aaa9f7f96811e102 Mon Sep 17 00:00:00 2001 From: webrascal Date: Thu, 7 Jan 2016 10:18:57 +1300 Subject: [PATCH 002/126] Get more explicit about the CommonJS doc options --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e95b8c4..349e738 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ I still think the easiest way to learn React is [the official tutorial](https:// ## Learning `npm` -`npm` is the Node.js package manager and is the most popular way front-end engineers and designers share JavaScript code. It includes a module system called `CommonJS` ([read up on it](https://webpack.github.io/docs/commonjs.html) -- it’s important) and lets you install command-line tools written in JavaScript. +`npm` is the Node.js package manager and is the most popular way front-end engineers and designers share JavaScript code. It includes a module system called `CommonJS` (read the [CommonJS Spec Wiki](http://wiki.commonjs.org/wiki/CommonJS) and/or the [Webpack CommonJS docs] (https://webpack.github.io/docs/commonjs.html) -- it’s important) and lets you install command-line tools written in JavaScript. Most reusable components, libraries and tools in the React ecosystem are available as `CommonJS` modules and are installed with `npm`. From 77c466032a88f7a9b09f65c8c59835950fe52581 Mon Sep 17 00:00:00 2001 From: Zhangjd Date: Thu, 7 Jan 2016 12:58:40 +0800 Subject: [PATCH 003/126] add README-zh.md --- README-zh.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 README-zh.md diff --git a/README-zh.md b/README-zh.md new file mode 100644 index 0000000..14d2ba2 --- /dev/null +++ b/README-zh.md @@ -0,0 +1,86 @@ +# 如何学习React + +如果你是一个 React (或者前端) 新手, 出于以下的原因, 你可能会对这个生态圈感到困惑: + +* React 的目标群体历来是喜欢尝试新事物的开发者和前端专家. +* Facebook 只开源了他们在实际使用的, 因此他们没有关注那些比 Facebook 小的工程需求. +* 现有的 React 指引水平层次不齐. + +在本文中, 我会假设你已有使用 HTML, CSS 和 JavaScript 开发网页的基础. + +## 为什么要听我的? + +关于 React, 现在已经有大量的相互冲突的建议了, 为什么要听我的? + +因为我是在 Facebook 构建并开源 React 的最初成员之一. 现在我离开了 Facebook 并加入了一家初创公司, 所以我也不会站在 Facebook 的立场上来表态. + +## 如何踏入 React 生态圈 + +所有的软件都是建立在某个技术栈之上的, 你需要对整个技术栈有足够深入的理解, 才能建造你的应用. 为什么 React 生态圈的工具似乎总让人感觉压力山大呢, 因为它总是以错误的顺序被解释: + +你应该按照以下的顺序进行学习, **而不是跳着学或者同时学习**: + +* [React](#user-content-学习-react-本身) +* [`npm`](#user-content-学习-npm) +* [JavaScript “bundlers”](#user-content-学习-javascript-打包工具) +* [ES6](#user-content-学习-es6) +* [Routing](#user-content-学习路由-routing) +* [Flux](#user-content-学习-flux) +* [Immutable.js](#user-content-学习-immutablejs) +* [Relay, Falcor 等](#user-content-learning-relay-falcor-等) + +并且: **你不需要把这些都学完才去使用 React.** 只需要在你遇到问题需要解决的时候, 才进入下一步的学习. + +## 学习 React 本身 + +有一种常见的误解是: 你需要花费大量时间在配置工具上, 然后才开始学习 React. 在官方文档里, 你可以找到 [copy-paste HTML template](https://facebook.github.io/react/docs/getting-started.html#quick-start-without-npm). 只需要保存为 `.html` 文件, 你就可以马上开始学习了. **这个步骤不需要任何工具, 你也无需额外学习工具使用, 直到你能熟练掌握 React 基础.** + +我依然觉得, 学习 React 最简单的方法是通过官方教程 [the official tutorial](https://facebook.github.io/react/docs/tutorial.html). + +## 学习 `npm` + +`npm` 是 Node.js 包管理工具, 也是前端工程师和设计师分享 JavaScript 代码最流行的方式. 它包含了名为 `CommonJS` (请 Google 一下 -- 它很重要) 的模块系统, 让你可以安装 JavaScript 写的命令行工具. + +在 React 生态圈中, 大部分可重用的组件、库和工具遵循 `CommonJS` 模块规范, 可通过 `npm` 来安装. + +## 学习 JavaScript 打包工具 + +出于若干技术原因, `CommonJS` 模块 (也就是 `npm` 里的所有内容) 不能直接用到浏览器. 你需要一个 JavaScript “打包工具(bundler)” 来把这些模块打包成 `.js` 文件, 使你可以在网页中通过 `