Skip to content

Commit

Permalink
docs(en): merge reactjs.org in zh-hans(reactjs#82)
Browse files Browse the repository at this point in the history
Add explicit heading IDs
  • Loading branch information
QC-L authored Feb 9, 2019
2 parents afd9450 + 49c6898 commit 3ec8f16
Show file tree
Hide file tree
Showing 211 changed files with 1,891 additions and 1,815 deletions.
8 changes: 4 additions & 4 deletions content/blog/2013-06-05-why-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ author: [petehunt]
There are a lot of JavaScript MVC frameworks out there. Why did we build React
and why would you want to use it?

## React isn't an MVC framework.
## React isn't an MVC framework. {#react-isnt-an-mvc-framework}

React is a library for building composable user interfaces. It encourages
the creation of reusable UI components which present data that changes over
time.

## React doesn't use templates.
## React doesn't use templates. {#react-doesnt-use-templates}

Traditionally, web application UIs are built using templates or HTML directives.
These templates dictate the full set of abstractions that you are allowed to use
Expand All @@ -33,7 +33,7 @@ to render views, which we see as an advantage over templates for a few reasons:
We've also created [JSX](/docs/jsx-in-depth.html), an optional syntax
extension, in case you prefer the readability of HTML to raw JavaScript.

## Reactive updates are dead simple.
## Reactive updates are dead simple. {#reactive-updates-are-dead-simple}

React really shines when your data changes over time.

Expand Down Expand Up @@ -63,7 +63,7 @@ Because this re-render is so fast (around 1ms for TodoMVC), the developer
doesn't need to explicitly specify data bindings. We've found this approach
makes it easier to build apps.

## HTML is just the beginning.
## HTML is just the beginning. {#html-is-just-the-beginning}

Because React has its own lightweight representation of the document, we can do
some pretty cool things with it:
Expand Down
8 changes: 4 additions & 4 deletions content/blog/2013-06-12-community-roundup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: [vjeux]

React was open sourced two weeks ago and it's time for a little round-up of what has been going on.

## Khan Academy Question Editor
## Khan Academy Question Editor {#khan-academy-question-editor}

It looks like [Sophie Alpert](http://sophiebits.com/) is the first person outside of Facebook and Instagram to push React code to production. We are very grateful for her contributions in form of pull requests, bug reports and presence on IRC ([#reactjs on Freenode](irc://chat.freenode.net/reactjs)). Sophie wrote about her experience using React:

Expand All @@ -16,7 +16,7 @@ It looks like [Sophie Alpert](http://sophiebits.com/) is the first person outsid
>
> [Read the full post...](http://sophiebits.com/2013/06/09/using-react-to-speed-up-khan-academy.html)
## Pimp my Backbone.View (by replacing it with React)
## Pimp my Backbone.View (by replacing it with React) {#pimp-my-backboneview-by-replacing-it-with-react}

[Paul Seiffert](https://blog.mayflower.de/) wrote a blog post that explains how to integrate React into Backbone applications.

Expand All @@ -28,15 +28,15 @@ It looks like [Sophie Alpert](http://sophiebits.com/) is the first person outsid
>
> [Read the full post...](https://blog.mayflower.de/3937-Backbone-React.html)
## Using facebook's React with require.js
## Using facebook's React with require.js {#using-facebooks-react-with-requirejs}

[Mario Mueller](http://blog.xenji.com/) wrote a menu component in React and was able to easily integrate it with require.js, EventEmitter2 and bower.

> I recently stumbled upon facebook's React library, which is a JavaScript library for building reusable frontend components. Even if this lib is only at version 0.3.x it behaves very stable, it is fast and is fun to code. I'm a big fan of require.js, so I tried to use React within the require.js eco system. It was not as hard as expected and here are some examples and some thoughts about it.
>
> [Read the full post...](http://blog.xenji.com/2013/06/facebooks-react-require-js.html)
## Origins of React
## Origins of React {#origins-of-react}

[Pete Hunt](http://www.petehunt.net/blog/) explained what differentiates React from other JavaScript libraries in [a previous blog post](/blog/2013/06/05/why-react.html). [Lee Byron](http://leebyron.com/) gives another perspective on Quora:

Expand Down
12 changes: 6 additions & 6 deletions content/blog/2013-06-19-community-roundup-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: [vjeux]

Since the launch we have received a lot of feedback and are actively working on React 0.4. In the meantime, here are the highlights of this week.

## Some quick thoughts on React
## Some quick thoughts on React {#some-quick-thoughts-on-react}

[Andrew Greig](http://www.andrewgreig.com/) made a blog post that gives a high level description of what React is.

Expand All @@ -19,7 +19,7 @@ Since the launch we have received a lot of feedback and are actively working on
>
> [Read the full post...](http://www.andrewgreig.com/637/)
## React and Socket.IO Chat Application
## React and Socket.IO Chat Application {#react-and-socketio-chat-application}

[Danial Khosravi](https://danialk.github.io/) made a real-time chat application that interacts with the back-end using Socket.IO.

Expand All @@ -28,7 +28,7 @@ Since the launch we have received a lot of feedback and are actively working on
>
> [Read the full post...](https://danialk.github.io/blog/2013/06/16/reactjs-and-socket-dot-io-chat-application/)
## React and Other Frameworks
## React and Other Frameworks {#react-and-other-frameworks}

[Pete Hunt](http://www.petehunt.net/blog/) wrote an answer on Quora comparing React and Angular directives. At the end, he explains how you can make an Angular directive that is in fact being rendered with React.

Expand All @@ -40,7 +40,7 @@ Since the launch we have received a lot of feedback and are actively working on
In the same vein, [Markov Twain](https://twitter.com/markov_twain/status/345702941845499906) re-implemented the examples on the front-page [with Ember](http://jsbin.com/azihiw/2/edit) and [Vlad Yazhbin](https://twitter.com/vla) re-implemented the tutorial [with Angular](http://jsfiddle.net/vla/Cdrse/).

## Web Components: React & x-tags
## Web Components: React & x-tags {#web-components-react--x-tags}

Mozilla and Google are actively working on Web Components. [Vjeux](http://blog.vjeux.com/) wrote a proof of concept that shows how to implement them using React.

Expand All @@ -49,7 +49,7 @@ Mozilla and Google are actively working on Web Components. [Vjeux](http://blog.v
>
> [Read the full post...](http://blog.vjeux.com/2013/javascript/custom-components-react-x-tags.html)
## React TodoMVC Example
## React TodoMVC Example {#react-todomvc-example}

[TodoMVC.com](http://todomvc.com/) is a website that collects various implementations of the same basic Todo app. [Pete Hunt](http://www.petehunt.net/blog/) wrote an idiomatic React version.

Expand All @@ -60,7 +60,7 @@ Mozilla and Google are actively working on Web Components. [Vjeux](http://blog.v
>
> [Read the source code...](https://github.com/tastejs/todomvc/tree/gh-pages/labs/architecture-examples/react)
## JSX is not HTML
## JSX is not HTML {#jsx-is-not-html}

Many of you pointed out differences between JSX and HTML. In order to clear up some confusion, we have added some documentation that covers the four main differences:

Expand Down
6 changes: 3 additions & 3 deletions content/blog/2013-06-21-react-v0-3-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ author: [zpao]
We have a ton of great stuff coming in v0.4, but in the meantime we're releasing v0.3.3. This release addresses some small issues people were having and simplifies our tools to make them easier to use.


## react-tools
## react-tools {#react-tools}

* Upgrade Commoner so `require` statements are no longer relativized when passing through the transformer. This was a feature needed when building React, but doesn't translate well for other consumers of `bin/jsx`.
* Upgraded our dependencies on Commoner and Recast so they use a different directory for their cache.
* Freeze our esprima dependency.


## React
## React {#react}

* Allow reusing the same DOM node to render different components. e.g. `React.renderComponent(<div/>, domNode); React.renderComponent(<span/>, domNode);` will work now.


## JSXTransformer
## JSXTransformer {#jsxtransformer}

* Improved the in-browser transformer so that transformed scripts will execute in the expected scope. The allows components to be defined and used from separate files.
12 changes: 6 additions & 6 deletions content/blog/2013-06-27-community-roundup-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: [vjeux]

The highlight of this week is that an interaction-heavy app has been ported to React. React components are solving issues they had with nested views.

## Moving From Backbone To React
## Moving From Backbone To React {#moving-from-backbone-to-react}

[Clay Allsopp](https://twitter.com/clayallsopp) successfully ported [Propeller](http://usepropeller.com/blog/posts/from-backbone-to-react/), a fairly big, interaction-heavy JavaScript app, to React.

Expand All @@ -17,7 +17,7 @@ The highlight of this week is that an interaction-heavy app has been ported to R
>
> [Read the full post...](http://usepropeller.com/blog/posts/from-backbone-to-react/)
## Grunt Task for JSX
## Grunt Task for JSX {#grunt-task-for-jsx}

[Eric Clemmons](https://ericclemmons.github.io/) wrote a task for [Grunt](http://gruntjs.com/) that applies the JSX transformation to your JavaScript files. It also works with [Browserify](http://browserify.org/) if you want all your files to be concatenated and minified together.

Expand Down Expand Up @@ -45,7 +45,7 @@ The highlight of this week is that an interaction-heavy app has been ported to R
>
> [Check out the project ...](https://github.com/ericclemmons/grunt-react)
## Backbone/Handlebars Nested Views
## Backbone/Handlebars Nested Views {#backbonehandlebars-nested-views}
[Joel Burget](http://joelburget.com/) wrote a blog post talking about the way we would write React-like components in Backbone and Handlebars.
Expand All @@ -57,13 +57,13 @@ The highlight of this week is that an interaction-heavy app has been ported to R
>
> [Read the full post...](http://joelburget.com/react/)
## JSRomandie Meetup
## JSRomandie Meetup {#jsromandie-meetup}
[Renault John Lecoultre](https://twitter.com/renajohn/) from [BugBuster](http://www.bugbuster.com) did a React introduction talk at a JS meetup called [JS Romandie](https://twitter.com/jsromandie) last week.
<script async class="speakerdeck-embed" data-id="888a9d50c01b01300df36658d0894ac1" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>
## CoffeeScript integration
## CoffeeScript integration {#coffeescript-integration}
[Vjeux](http://blog.vjeux.com/) used the fact that JSX is just a syntactic sugar on-top of regular JS to rewrite the React front-page examples in CoffeeScript.
Expand All @@ -81,7 +81,7 @@ The highlight of this week is that an interaction-heavy app has been ported to R
>
> [Read the full post...](http://blog.vjeux.com/2013/javascript/react-coffeescript.html)
## Tutorial in Plain JavaScript
## Tutorial in Plain JavaScript {#tutorial-in-plain-javascript}
We've seen a lot of people comparing React with various frameworks. [Ricardo Tomasi](http://ricardo.cc/) decided to re-implement the tutorial without any framework, just plain JavaScript.
Expand Down
4 changes: 2 additions & 2 deletions content/blog/2013-07-02-react-v0-4-autobind-by-default.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author: [zpao]
React v0.4 is very close to completion. As we finish it off, we'd like to share with you some of the major changes we've made since v0.3. This is the first of several posts we'll be making over the next week.


## What is React.autoBind?
## What is React.autoBind? {#what-is-reactautobind}

If you take a look at most of our current examples, you'll see us using `React.autoBind` for event handlers. This is used in place of `Function.prototype.bind`. Remember that in JS, [function calls are late-bound](https://bonsaiden.github.io/JavaScript-Garden/#function.this). That means that if you simply pass a function around, the `this` used inside won't necessarily be the `this` you expect. `Function.prototype.bind` creates a new, properly bound, function so that when called, `this` is exactly what you expect it to be.

Expand All @@ -33,7 +33,7 @@ React.createClass({
```


## What's Changing in v0.4?
## What's Changing in v0.4? {#whats-changing-in-v04}

After using `React.autoBind` for a few weeks, we realized that there were very few times that we didn't want that behavior. So we made it the default! Now all methods defined within `React.createClass` will already be bound to the correct instance.

Expand Down
8 changes: 4 additions & 4 deletions content/blog/2013-07-03-community-roundup-4.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: [vjeux]

React reconciliation process appears to be very well suited to implement a text editor with a live preview as people at Khan Academy show us.

## Khan Academy
## Khan Academy {#khan-academy}

[Ben Kamens](http://bjk5.com/) explains how [Sophie Alpert](http://sophiebits.com/) and [Joel Burget](http://joelburget.com/) are promoting React inside of [Khan Academy](https://www.khanacademy.org/). They now have three projects in the works using React.

Expand All @@ -21,7 +21,7 @@ The best part is the demo of how React reconciliation process makes live editing
[![](../images/blog/monkeys.gif)](http://bjk5.com/post/53742233351/getting-your-team-to-adopt-new-technology)

## React Snippets
## React Snippets {#react-snippets}

Over the past several weeks, members of our team, [Pete Hunt](http://www.petehunt.net/) and [Paul O'Shannessy](http://zpao.com/), answered many questions that were asked in the [React group](https://groups.google.com/forum/#!forum/reactjs). They give a good overview of how to integrate React with other libraries and APIs through the use of [Mixins](/docs/reusable-components.html) and [Lifecycle Methods](/docs/working-with-the-browser.html).

Expand All @@ -44,13 +44,13 @@ Over the past several weeks, members of our team, [Pete Hunt](http://www.petehun
>
> * [JSFiddle](http://jsfiddle.net/LQxy7/): Your React component simply render empty divs, and then in componentDidMount() you call React.renderComponent() on each of those divs to set up a new root React tree. Be sure to explicitly unmountAndReleaseReactRootNode() for each component in componentWillUnmount().
## Introduction to React Screencast
## Introduction to React Screencast {#introduction-to-react-screencast}

[Pete Hunt](http://www.petehunt.net/) recorded himself implementing a simple `<Blink>` tag in React.

<figure><iframe src="https://player.vimeo.com/video/67248575" width="100%" height="340" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></figure>

## Snake in React
## Snake in React {#snake-in-react}

[Tom Occhino](http://tomocchino.com/) implemented Snake in 150 lines with React.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author: [zpao]
Many of the questions we got following the public launch of React revolved around `props`, specifically that people wanted to do validation and to make sure their components had sensible defaults.


## Validation
## Validation {#validation}

Oftentimes you want to validate your `props` before you use them. Perhaps you want to ensure they are a specific type. Or maybe you want to restrict your prop to specific values. Or maybe you want to make a specific prop required. This was always possible — you could have written validations in your `render` or `componentWillReceiveProps` functions, but that gets clunky fast.

Expand All @@ -29,7 +29,7 @@ React.createClass({
```


## Default Values
## Default Values {#default-values}

One common pattern we've seen with our React code is to do something like this:

Expand Down
6 changes: 3 additions & 3 deletions content/blog/2013-07-17-react-v0-4-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ React v0.4 has some big changes. We've also restructured the documentation to be
When you're ready, [go download it](/docs/installation.html)!


### React
### React {#react}

* Switch from using `id` attribute to `data-reactid` to track DOM nodes. This allows you to integrate with other JS and CSS libraries more easily.
* Support for more DOM elements and attributes (e.g., `<canvas>`)
Expand All @@ -25,15 +25,15 @@ When you're ready, [go download it](/docs/installation.html)!
* We've implemented an improved synthetic event system that conforms to the W3C spec.
* Updates to your component are batched now, which may result in a significantly faster re-render of components. `this.setState` now takes an optional callback as its second parameter. If you were using `onClick={this.setState.bind(this, state)}` previously, you'll want to make sure you add a third parameter so that the event is not treated as the callback.

### JSX
### JSX {#jsx}

* Support for comment nodes `<div>{/* this is a comment and won't be rendered */}</div>`
* Children are now transformed directly into arguments instead of being wrapped in an array
E.g. `<div><Component1/><Component2/></div>` is transformed into `React.DOM.div(null, Component1(null), Component2(null))`.
Previously this would be transformed into `React.DOM.div(null, [Component1(null), Component2(null)])`.
If you were using React without JSX previously, your code should still work.

### react-tools
### react-tools {#react-tools}

* Fixed a number of bugs when transforming directories
* No longer re-write `require()`s to be relative unless specified
12 changes: 6 additions & 6 deletions content/blog/2013-07-23-community-roundup-5.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: [vjeux]

We launched the [React Facebook Page](https://www.facebook.com/react) along with the React v0.4 launch. 700 people already liked it to get updated on the project :)

## Cross-browser onChange
## Cross-browser onChange {#cross-browser-onchange}

[Sophie Alpert](http://sophiebits.com/) from [Khan Academy](https://www.khanacademy.org/) worked on a cross-browser implementation of `onChange` event that landed in v0.4. She wrote a blog post explaining the various browser quirks she had to deal with.

Expand All @@ -16,7 +16,7 @@ We launched the [React Facebook Page](https://www.facebook.com/react) along with
> [Read the full post...](http://sophiebits.com/2013/06/18/a-near-perfect-oninput-shim-for-ie-8-and-9.html)

## React Samples
## React Samples {#react-samples}

Learning a new library is always easier when you have working examples you can play with. [jwh](https://github.com/jhw) put many of them on his [react-samples GitHub repo](https://github.com/jhw/react-samples).

Expand Down Expand Up @@ -50,7 +50,7 @@ Learning a new library is always easier when you have working examples you can p
> * Toggle [#1](https://rawgithub.com/jhw/react-samples/master/html/toggle.html)

## React Chosen Wrapper
## React Chosen Wrapper {#react-chosen-wrapper}

[Cheng Lou](https://github.com/chenglou) wrote a wrapper for the [Chosen](https://harvesthq.github.io/chosen/) input library called [react-chosen](https://github.com/chenglou/react-chosen). It took just 25 lines to be able to use jQuery component as a React one.

Expand All @@ -64,21 +64,21 @@ React.renderComponent(
```


## JSX and ES6 Template Strings
## JSX and ES6 Template Strings {#jsx-and-es6-template-strings}

[Domenic Denicola](http://domenicdenicola.com/) wrote a slide deck about the great applications of ES6 features and one slide shows how we could use Template Strings to compile JSX at run-time without the need for a pre-processing phase.

<figure><iframe src="https://www.slideshare.net/slideshow/embed_code/24187146?rel=0&startSlide=36" width="100%" height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe></figure>


## React Presentation
## React Presentation {#react-presentation}

[Tom Occhino](http://tomocchino.com/) and [Jordan Walke](https://github.com/jordwalke), React developers, did a presentation of React at Facebook Seattle's office. Check out the first 25 minutes for the presentation and the remaining 45 for a Q&A. I highly recommend you watching this video.

<figure><iframe width="650" height="400" src="//www.youtube-nocookie.com/embed/XxVg_s8xAms" frameborder="0" allowfullscreen></iframe></figure>


## Docs
## Docs {#docs}

[Pete Hunt](http://www.petehunt.net/) rewrote the entirety of the docs for v0.4. The goal was to add more explanation about why we built React and what the best practices are.

Expand Down
4 changes: 2 additions & 2 deletions content/blog/2013-07-26-react-v0-4-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author: [zpao]
React v0.4.1 is a small update, mostly containing correctness fixes. Some code has been restructured internally but those changes do not impact any of our public APIs.


## React
## React {#react}

* `setState` callbacks are now executed in the scope of your component.
* `click` events now work on Mobile Safari.
Expand All @@ -16,7 +16,7 @@ React v0.4.1 is a small update, mostly containing correctness fixes. Some code h
* Added checksums to detect and correct cases where server-side rendering markup mismatches what React expects client-side.


## JSXTransformer
## JSXTransformer {#jsxtransformer}

* Improved environment detection so it can be run in a non-browser environment.

Expand Down
Loading

0 comments on commit 3ec8f16

Please sign in to comment.