diff --git a/blog/index.html b/blog/index.html index a655e4dd97..3ce23fd796 100644 --- a/blog/index.html +++ b/blog/index.html @@ -502,7 +502,7 @@ Is this some sort of template language? Specifically no. This might have been th
<textarea name="description" value="This is a description." />
If you do decide to use children, they will behave like defaultValue.
The selected <option> in an HTML <select> is normally specified through that option's selected attribute. In React, in order to make components easier to manipulate, the following format is adopted instead:
<select value="B">
+ <option value="A">Apple</option>
+ <option value="B">Banana</option>
+ <option value="C">Cranberry</option>
+ </select>
+To make an uncontrolled component, defaultValue is used instead.
With React you simply pass your event handler as a camelCased prop similar to how you'd do it in normal HTML. React ensures that all events behave identically in IE8 and above by implementing a synthetic event system. That is, React knows how to bubble and capture events according to the spec, and the events passed to your event handler are guaranteed to be consistent with the W3C spec, regardless of which browser you're using.
If you'd like to use React on a touch device (i.e. a phone or tablet), simply call React.initializeTouchEvents(true); to turn them on.
Under the hood React does a few things to keep your code performant and easy to understand.
Autobinding: When creating callbacks in JavaScript you usually need to explicitly bind a method to its instance such that the value of this is correct. With React, every method is automatically bound to its component instance. React caches the bound method such that it's extremely CPU and memory efficient. It's also less typing!
The uncompressed, development version of React core with inline documentation.
<script src="http://fb.me/react-0.5.1.js"></script>
+The compressed, production version of React with add-ons.
+<script src="http://fb.me/react-with-addons-0.5.1.min.js"></script>
+The uncompressed, development version of React with add-ons.
+<script src="http://fb.me/react-with-addons-0.5.1.js"></script>
The JSX transformer used to support XML syntax in JavaScript.
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
diff --git a/feed.xml b/feed.xml
index 95d7396419..fd0369bce2 100644
--- a/feed.xml
+++ b/feed.xml
@@ -78,7 +78,7 @@ Is this some sort of template language? Specifically no. This might have been th
<p><img src="/react/img/blog/steve_reverse.gif" style="float: right;" />
<div style="width: 320px;"><blockquote class="twitter-tweet"><p>I think this reversed gif of Steve Urkel best describes my changing emotions towards the React Lib <a href="http://t.co/JoX0XqSXX3">http://t.co/JoX0XqSXX3</a></p>— Ryan Seddon (@ryanseddon) <a href="https://twitter.com/ryanseddon/statuses/398572848802852864">November 7, 2013</a></blockquote></div></p>
- 2013-11-18T00:00:00+01:00
+ 2013-11-18T00:00:00-08:00
http://facebook.github.io/react/blog/2013/11/18/community-roundup-11.html
http://facebook.github.io/react/blog/2013/11/18/community-roundup-11.html
@@ -194,7 +194,7 @@ Is this some sort of template language? Specifically no. This might have been th
<blockquote class="twitter-tweet"><p>This weekend <a href="https://twitter.com/search?q=%23angular&src=hash">#angular</a> died for me. Meet new king <a href="https://twitter.com/search?q=%23reactjs&src=hash">#reactjs</a></p>— Eldar Djafarov ッ (@edjafarov) <a href="https://twitter.com/edjafarov/statuses/397033796710961152">November 3, 2013</a></blockquote>
- 2013-11-06T00:00:00+01:00
+ 2013-11-06T00:00:00-08:00
http://facebook.github.io/react/blog/2013/11/06/community-roundup-10.html
http://facebook.github.io/react/blog/2013/11/06/community-roundup-10.html
@@ -340,7 +340,7 @@ Is this some sort of template language? Specifically no. This might have been th
<h2><a class="anchor" name="and-thats-it"></a>And that's it <a class="hash-link" href="#and-thats-it">#</a></h2>
<p>Hopefully this gives you an idea of how to think about building components and applications with React. While it may be a little more typing than you're used to, remember that code is read far more than it's written, and it's extremely easy to read this modular, explicit code. As you start to build large libraries of components you'll appreciate this explicitness and modularity, and with code reuse your lines of code will start to shrink :)</p>
- 2013-11-05T00:00:00+01:00
+ 2013-11-05T00:00:00-08:00
http://facebook.github.io/react/blog/2013/11/05/thinking-in-react.html
http://facebook.github.io/react/blog/2013/11/05/thinking-in-react.html
@@ -360,7 +360,7 @@ Is this some sort of template language? Specifically no. This might have been th
<li>Fixed bug with transition and animation event detection.</li>
</ul>
- 2013-10-29T00:00:00+01:00
+ 2013-10-29T00:00:00-07:00
http://facebook.github.io/react/blog/2013/10/29/react-v0-5-1.html
http://facebook.github.io/react/blog/2013/10/29/react-v0-5-1.html
@@ -409,7 +409,7 @@ Is this some sort of template language? Specifically no. This might have been th
<li>Improved support for maintaining line numbers when transforming.</li>
</ul>
- 2013-10-16T00:00:00+02:00
+ 2013-10-16T00:00:00-07:00
http://facebook.github.io/react/blog/2013/10/16/react-v0.5.0.html
http://facebook.github.io/react/blog/2013/10/16/react-v0.5.0.html
@@ -494,7 +494,7 @@ Is this some sort of template language? Specifically no. This might have been th
<p><a href="http://www.phpied.com/reactive-table/">Read the full article...</a></p>
</blockquote>
- 2013-10-03T00:00:00+02:00
+ 2013-10-03T00:00:00-07:00
http://facebook.github.io/react/blog/2013/10/03/community-roundup-9.html
http://facebook.github.io/react/blog/2013/10/03/community-roundup-9.html
@@ -555,7 +555,7 @@ Is this some sort of template language? Specifically no. This might have been th
<iframe width="100%" height="300" src="http://jsfiddle.net/vjeux/QL9tz/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
- 2013-09-24T00:00:00+02:00
+ 2013-09-24T00:00:00-07:00
http://facebook.github.io/react/blog/2013/09/24/community-roundup-8.html
http://facebook.github.io/react/blog/2013/09/24/community-roundup-8.html
@@ -636,7 +636,7 @@ Is this some sort of template language? Specifically no. This might have been th
<p><a href="https://github.com/facebook/react-page/">Try it out ...</a></p>
</blockquote>
- 2013-08-26T00:00:00+02:00
+ 2013-08-26T00:00:00-07:00
http://facebook.github.io/react/blog/2013/08/26/community-roundup-7.html
http://facebook.github.io/react/blog/2013/08/26/community-roundup-7.html
@@ -677,7 +677,7 @@ Is this some sort of template language? Specifically no. This might have been th
<p>For the initial release, we've only tested on Python 2.7. Look out for support for Python 3 in the future, and if you see anything that can be improved, we welcome your <a href="https://github.com/facebook/react-python/blob/master/CONTRIBUTING.md">contributions</a>!</p>
- 2013-08-19T00:00:00+02:00
+ 2013-08-19T00:00:00-07:00
http://facebook.github.io/react/blog/2013/08/19/use-react-and-jsx-in-python-applications.html
http://facebook.github.io/react/blog/2013/08/19/use-react-and-jsx-in-python-applications.html
@@ -749,7 +749,7 @@ Is this some sort of template language? Specifically no. This might have been th
<p><a href="https://groups.google.com/forum/#!msg/reactjs/e3bYersyd64/qODfcuBR9LwJ">Read the full post...</a></p>
</blockquote>
- 2013-08-05T00:00:00+02:00
+ 2013-08-05T00:00:00-07:00
http://facebook.github.io/react/blog/2013/08/05/community-roundup-6.html
http://facebook.github.io/react/blog/2013/08/05/community-roundup-6.html
diff --git a/index.html b/index.html
index 8b751bc4bc..923b2f34b5 100644
--- a/index.html
+++ b/index.html
@@ -70,23 +70,25 @@
- Declarative
+ Just the UI
- React uses a declarative paradigm that makes it easier to reason about
- your application.
+ Lots of people use React as the V in MVC.
+ Since React makes no assumptions about the rest of your technology stack,
+ it's easy to try it out on a small feature in an existing project.
- Efficient
+ Virtual DOM
- React computes the minimal set of changes necessary to keep your DOM
- up-to-date.
+ React uses a virtual DOM diff implementation for ultra-high performance. It can also
+ render on the server using Node.js — no heavy browser DOM required.
- Flexible
+ Data flow
- React works with the libraries and frameworks that you already know.
+ React implements one-way reactive data flow which reduces boilerplate and is
+ easier to reason about than traditional data binding.
@@ -123,7 +125,7 @@
This example uses state to track the current list of items as well as
the text that the user has entered. Although event handlers appear to be
rendered inline, they will be collected and implemented using event
- delegation.
+ delegation.
For parent-child communication, simply pass props.
+ +For child-parent communication:
+Say your GroceryList component has a list of items generated through an array. When a list item is clicked, you want to display its name:
/** @jsx React.DOM */
+
+var GroceryList = React.createClass({
+ handleClick: function(i) {
+ console.log('You clicked: ' + this.props.items[i]);
+ },
+
+ render: function() {
+ return (
+ <div>
+ {this.props.items.map(function(item, i) {
+ return (
+ <div onClick={this.handleClick.bind(this, i)} key={i}>{item}</div>
+ );
+ }, this)}
+ </div>
+ );
+ }
+});
+
+React.renderComponent(
+ <GroceryList items={['Apple', 'Banana', 'Cranberry']} />, mountNode
+);
+Notice the use of bind(this, arg1, arg2, ...): we're simply passing more arguments to handleClick. This is not a new React concept; it's just JavaScript.
componentDidMount is called after the component is mounted and has a DOM representation. This is often a place where you would attach generic DOM events.
Notice that the event callback is bound to the react component and not the original element. React automatically binds methods to the current component instance for you through a process of autobinding.
+Fetch data in componentDidMount. When the response arrives, store the data in state, triggering a render to update your UI.
This example fetches the desired Github user's lastest gist:
+This example fetches the desired Github user's latest gist:
/** @jsx React.DOM */
var UserGist = React.createClass({
diff --git a/tips/inline-styles.html b/tips/inline-styles.html
index 782e591334..92e32fd58e 100644
--- a/tips/inline-styles.html
+++ b/tips/inline-styles.html
@@ -310,6 +310,10 @@
False in JSX
+
+ Communicate Between Components
+
+