Files
react/feed.xml
T
2016-01-08 18:33:53 +00:00

949 lines
142 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>React</title>
<description>A JavaScript library for building user interfaces</description>
<link>https://facebook.github.io/react</link>
<atom:link href="https://facebook.github.io/react/feed.xml" rel="self" type="application/rss+xml" />
<item>
<title>(A =&gt; B) !=&gt; (B =&gt; A)</title>
<description>&lt;p&gt;The documentation for &lt;code&gt;componentWillReceiveProps&lt;/code&gt; states that &lt;code&gt;componentWillReceiveProps&lt;/code&gt; will be invoked when the props change as the result of a rerender. Some people assume this means &amp;quot;if &lt;code&gt;componentWillReceiveProps&lt;/code&gt; is called, then the props must have changed&amp;quot;, but that conclusion is logically incorrect.&lt;/p&gt;
&lt;p&gt;The guiding principle is one of my favorites from formal logic/mathematics:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A implies B does not imply B implies A&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Example: &amp;quot;If I eat moldy food, then I will get sick&amp;quot; does not imply &amp;quot;if I am sick, then I must have eaten moldy food&amp;quot;. There are many other reasons I could be feeling sick. For instance, maybe the flu is circulating around the office. Similarly, there are many reasons that &lt;code&gt;componentWillReceiveProps&lt;/code&gt; might get called, even if the props didnt change.&lt;/p&gt;
&lt;p&gt;If you dont believe me, call &lt;code&gt;ReactDOM.render()&lt;/code&gt; three times with the exact same props, and try to predict the number of times &lt;code&gt;componentWillReceiveProps&lt;/code&gt; will get called:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;componentWillReceiveProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;nextProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;componentWillReceiveProps&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nextProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Bar&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/div&amp;gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;container&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;drinks&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this case, the answer is &amp;quot;2&amp;quot;. React calls &lt;code&gt;componentWillReceiveProps&lt;/code&gt; twice (once for each of the two updates). Both times, the value of &amp;quot;drinks&amp;quot; is printed (ie. the props didnt change).&lt;/p&gt;
&lt;p&gt;To understand why, we need to think about what &lt;em&gt;could&lt;/em&gt; have happened. The data &lt;em&gt;could&lt;/em&gt; have changed between the initial render and the two subsequent updates, if the code had performed a mutation like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;drinks&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;food&amp;#39;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;bar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;noise&amp;#39;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mydata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;React has no way of knowing that the data didnt change. Therefore, React needs to call &lt;code&gt;componentWillReceiveProps&lt;/code&gt;, because the component needs to be notified of the new props (even if the new props happen to be the same as the old props).&lt;/p&gt;
&lt;p&gt;You might think that React could just use smarter checks for equality, but there are some issues with this idea:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The old &lt;code&gt;mydata&lt;/code&gt; and the new &lt;code&gt;mydata&lt;/code&gt; are actually the same physical object (only the objects internal value changed). Since the references are triple-equals-equal, doing an equality check doesnt tell us if the value has changed. The only possible solution would be to have created a deep copy of the data, and then later do a deep comparison - but this can be prohibitively expensive for large data structures (especially ones with cycles).&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;mydata&lt;/code&gt; object might contain references to functions which have captured variables within closures. There is no way for React to peek into these closures, and thus no way for React to copy them and/or verify equality.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;mydata&lt;/code&gt; object might contain references to objects which are re-instantiated during the parent&amp;#39;s render (ie. not triple-equals-equal) but are conceptually equal (ie. same keys and same values). A deep-compare (expensive) could detect this, except that functions present a problem again because there is no reliable way to compare two functions to see if they are semantically equivalent.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Given the language constraints, it is sometimes impossible for us to achieve meaningful equality semantics. In such cases, React will call &lt;code&gt;componentWillReceiveProps&lt;/code&gt; (even though the props might not have changed) so the component has an opportunity to examine the new props and act accordingly.&lt;/p&gt;
&lt;p&gt;As a result, your implementation of &lt;code&gt;componentWillReceiveProps&lt;/code&gt; MUST NOT assume that your props have changed. If you want an operation (such as a network request) to occur only when props have changed, your &lt;code&gt;componentWillReceiveProps&lt;/code&gt; code needs to check to see if the props actually changed.&lt;/p&gt;
</description>
<pubDate>2016-01-08T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2016/01/08/A-implies-B-does-not-imply-B-implies-A.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/01/08/A-implies-B-does-not-imply-B-implies-A.html</guid>
</item>
<item>
<title>React v0.14.4</title>
<description>&lt;p&gt;Happy December! We have a minor point release today. It has just a few small bug fixes.&lt;/p&gt;
&lt;p&gt;The release is now available for download:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-0.14.4.js&quot;&gt;https://fb.me/react-0.14.4.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-0.14.4.min.js&quot;&gt;https://fb.me/react-0.14.4.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React with Add-Ons&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.4.js&quot;&gt;https://fb.me/react-with-addons-0.14.4.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.4.min.js&quot;&gt;https://fb.me/react-with-addons-0.14.4.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM&lt;/strong&gt; (include React in the page before React DOM)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-0.14.4.js&quot;&gt;https://fb.me/react-dom-0.14.4.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-0.14.4.min.js&quot;&gt;https://fb.me/react-dom-0.14.4.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM Server&lt;/strong&gt; (include React in the page before React DOM Server)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-server-0.14.4.js&quot;&gt;https://fb.me/react-dom-server-0.14.4.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-server-0.14.4.min.js&quot;&gt;https://fb.me/react-dom-server-0.14.4.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We&amp;#39;ve also published version &lt;code&gt;0.14.4&lt;/code&gt; of the &lt;code&gt;react&lt;/code&gt;, &lt;code&gt;react-dom&lt;/code&gt;, and addons packages on npm and the &lt;code&gt;react&lt;/code&gt; package on bower.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;changelog&quot;&gt;&lt;/a&gt;Changelog &lt;a class=&quot;hash-link&quot; href=&quot;#changelog&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react&quot;&gt;&lt;/a&gt;React &lt;a class=&quot;hash-link&quot; href=&quot;#react&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Minor internal changes for better compatibility with React Native&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-dom&quot;&gt;&lt;/a&gt;React DOM &lt;a class=&quot;hash-link&quot; href=&quot;#react-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;autoCapitalize&lt;/code&gt; and &lt;code&gt;autoCorrect&lt;/code&gt; props are now set as attributes in the DOM instead of properties to improve cross-browser compatibility&lt;/li&gt;
&lt;li&gt;Fixed bug with controlled &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; elements not handling updates properly&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-perf-add-on&quot;&gt;&lt;/a&gt;React Perf Add-on &lt;a class=&quot;hash-link&quot; href=&quot;#react-perf-add-on&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Some DOM operation names have been updated for clarity in the output of &lt;code&gt;.printDOM()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
<pubDate>2015-12-29T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/29/react-v0.14.4.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/29/react-v0.14.4.html</guid>
</item>
<item>
<title>React Components, Elements, and Instances</title>
<description>&lt;p&gt;The difference between &lt;strong&gt;components, their instances, and elements&lt;/strong&gt; confuses many React beginners. Why are there three different terms to refer to something that is painted on screen?&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;managing-the-instances&quot;&gt;&lt;/a&gt;Managing the Instances &lt;a class=&quot;hash-link&quot; href=&quot;#managing-the-instances&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If youre new to React, you probably only worked with component classes and instances before. For example, you may declare a &lt;code&gt;Button&lt;/code&gt; &lt;em&gt;component&lt;/em&gt; by creating a class. When the app is running, you may have several &lt;em&gt;instances&lt;/em&gt; of this component on screen, each with its own properties and local state. This is the traditional object-oriented UI programming. Why introduce &lt;em&gt;elements&lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;In this traditional UI model, it is up to you to take care of creating and destroying child component instances. If a &lt;code&gt;Form&lt;/code&gt; component wants to render a &lt;code&gt;Button&lt;/code&gt; component, it needs to create its instance, and manually keep it up to date with any new information.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Form&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;TraditionalObjectOrientedView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Read some data passed to the view&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attrs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Form is not yet submitted. Create the button!&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// The button is visible. Update its text!&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attrs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Form was submitted. Destroy the button!&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;removeChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;destroy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Form was submitted. Show the success message!&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Success!&amp;#39;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;el&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is pseudocode, but it is more or less what you end up with when you write composite UI code that behaves consistently in an object-oriented way using a library like Backbone.&lt;/p&gt;
&lt;p&gt;Each component instance has to keep references to its DOM node and to the instances of the children components, and create, update, and destroy them when the time is right. The lines of code grow as the square of the number of possible states of the component, and the parents have direct access to their children component instances, making it hard to decouple them in the future.&lt;/p&gt;
&lt;p&gt;So how is React different?&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;elements-describe-the-tree&quot;&gt;&lt;/a&gt;Elements Describe the Tree &lt;a class=&quot;hash-link&quot; href=&quot;#elements-describe-the-tree&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In React, this is where the &lt;em&gt;elements&lt;/em&gt; come to rescue. &lt;strong&gt;An element is a plain object &lt;em&gt;describing&lt;/em&gt; a component instance or DOM node and its desired properties.&lt;/strong&gt; It contains only information about the component type (for example, a &lt;code&gt;Button&lt;/code&gt;), its properties (for example, its &lt;code&gt;color&lt;/code&gt;), and any child elements inside it.&lt;/p&gt;
&lt;p&gt;An element is not an actual instance. Rather, it is a way to tell React what you &lt;em&gt;want&lt;/em&gt; to see on the screen. You cant call any methods on the element. Its just an immutable description object with two fields: &lt;code&gt;type: (string | ReactClass)&lt;/code&gt; and &lt;code&gt;props: Object&lt;/code&gt;&lt;sup id=&quot;fnref1&quot;&gt;&lt;a href=&quot;#fn1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;dom-elements&quot;&gt;&lt;/a&gt;DOM Elements &lt;a class=&quot;hash-link&quot; href=&quot;#dom-elements&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When an elements &lt;code&gt;type&lt;/code&gt; is a string, it represents a DOM node with that tag name, and &lt;code&gt;props&lt;/code&gt; correspond to its attributes. This is what React will render. For example:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button button-blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This element is just a way to represent the following HTML as a plain object:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;button&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;button button-blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;b&amp;gt;&lt;/span&gt;
OK!
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/b&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note how elements can be nested. By convention, when we want to create an element tree, we specify one or more child elements as the &lt;code&gt;children&lt;/code&gt; prop of their containing element.&lt;/p&gt;
&lt;p&gt;Whats important is that both child and parent elements are &lt;em&gt;just descriptions and not the actual instances&lt;/em&gt;. They dont refer to anything on the screen when you create them. You can create them and throw them away, and it wont matter much.&lt;/p&gt;
&lt;p&gt;React elements are easy to traverse, dont need to be parsed, and of course they are much lighter than the actual DOM elements—theyre just objects!&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;component-elements&quot;&gt;&lt;/a&gt;Component Elements &lt;a class=&quot;hash-link&quot; href=&quot;#component-elements&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;However, the &lt;code&gt;type&lt;/code&gt; of an element can also be a function or a class corresponding to a React component:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is the core idea of React.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An element describing a component is also an element, just like an element describing the DOM node. They can be nested and mixed with each other.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This feature lets you define a &lt;code&gt;DangerButton&lt;/code&gt; component as a &lt;code&gt;Button&lt;/code&gt; with a specific &lt;code&gt;color&lt;/code&gt; property value without worrying about whether &lt;code&gt;Button&lt;/code&gt; renders to a DOM &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;, a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;, or something else entirely:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DangerButton&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;red&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can mix and match DOM and component elements in a single element tree:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DeleteAccount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;div&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;p&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Are you sure?&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DangerButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Yep&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Cancel&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Or, if you prefer JSX:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DeleteAccount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Are&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sure&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;?&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/p&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;DangerButton&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Yep&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/DangerButton&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Cancel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/Button&amp;gt;&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This mix and matching helps keep components decoupled from each other, as they can express both &lt;em&gt;is-a&lt;/em&gt; and &lt;em&gt;has-a&lt;/em&gt; relationships exclusively through composition:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Button&lt;/code&gt; is a DOM &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; with specific properties.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DangerButton&lt;/code&gt; is a &lt;code&gt;Button&lt;/code&gt; with specific properties.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;DeleteAccount&lt;/code&gt; contains a &lt;code&gt;Button&lt;/code&gt; and a &lt;code&gt;DangerButton&lt;/code&gt; inside a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;components-encapsulate-element-trees&quot;&gt;&lt;/a&gt;Components Encapsulate Element Trees &lt;a class=&quot;hash-link&quot; href=&quot;#components-encapsulate-element-trees&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When React sees an element with a function or class &lt;code&gt;type&lt;/code&gt;, it knows to ask &lt;em&gt;that&lt;/em&gt; component what element it renders to, given the corresponding &lt;code&gt;props&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When it sees this element:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;React will ask &lt;code&gt;Button&lt;/code&gt; what it renders to. The &lt;code&gt;Button&lt;/code&gt; will return this element:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button button-blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;React will repeat this process until it knows the underlying DOM tag elements for every component on the page.&lt;/p&gt;
&lt;p&gt;React is like a child asking “what is Y” for every “X is Y” you explain to them until they figure out every little thing in the world.&lt;/p&gt;
&lt;p&gt;Remember the &lt;code&gt;Form&lt;/code&gt; example above? It can be written in React as follows&lt;sup id=&quot;fnref1&quot;&gt;&lt;a href=&quot;#fn1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Form&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Form submitted! Return a message element.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Message&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Success!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Form is still visible! Return a button element.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thats it! For a React component, props are the input, and an element tree is the output.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The returned element tree can contain both elements describing DOM nodes, and elements describing other components. This lets you compose independent parts of UI without relying on their internal DOM structure.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We let React create, update, and destroy instances. We &lt;em&gt;describe&lt;/em&gt; them with elements we return from the components, and React takes care of managing the instances.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;components-can-be-classes-or-functions&quot;&gt;&lt;/a&gt;Components Can Be Classes or Functions &lt;a class=&quot;hash-link&quot; href=&quot;#components-can-be-classes-or-functions&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In the code above, &lt;code&gt;Form&lt;/code&gt;, &lt;code&gt;Message&lt;/code&gt;, and &lt;code&gt;Button&lt;/code&gt; are React components. They can either be written as functions, like above, or as classes descending from &lt;code&gt;React.Component&lt;/code&gt;. These three ways to declare a component are mostly equivalent:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// 1) As a function of props&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button button-&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 2) Using the React.createClass() factory&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button button-&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// 3) As an ES6 class descending from React.Component&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button button-&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When a component is defined as a class, it is a little bit more powerful than a functional component. It can store some local state and perform custom logic when the corresponding DOM node is created or destroyed.&lt;/p&gt;
&lt;p&gt;A functional component is less powerful but is simpler, and acts like a class component with just a single &lt;code&gt;render()&lt;/code&gt; method. Unless you need features available only in a class, we encourage you to use functional components instead.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;However, whether functions or classes, fundamentally they are all components to React. They take the props as their input, and return the elements as their output.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;top-down-reconciliation&quot;&gt;&lt;/a&gt;Top-Down Reconciliation &lt;a class=&quot;hash-link&quot; href=&quot;#top-down-reconciliation&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you call:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;root&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;React will ask the &lt;code&gt;Form&lt;/code&gt; component what element tree it returns, given those &lt;code&gt;props&lt;/code&gt;. It will gradually “refine” its understanding of your component tree in terms of simpler primitives:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// React: You told me this...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;isSubmitted&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;buttonText&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// React: ...And Form told me this...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;blue&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// React: ...and Button told me this! I guess I&amp;#39;m done.&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;className&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;button button-blue&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;b&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;children&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;OK!&amp;#39;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is a part of the process that React calls &lt;a href=&quot;/react/docs/reconciliation.html&quot;&gt;reconciliation&lt;/a&gt; which starts when you call &lt;a href=&quot;/react/docs/top-level-api.html#reactdom.render&quot;&gt;&lt;code&gt;ReactDOM.render()&lt;/code&gt;&lt;/a&gt; or &lt;a href=&quot;/react/docs/component-api.html#setstate&quot;&gt;&lt;code&gt;setState()&lt;/code&gt;&lt;/a&gt;. By the end of the reconciliation, React knows the result DOM tree, and a renderer like &lt;code&gt;react-dom&lt;/code&gt; or &lt;code&gt;react-native&lt;/code&gt; applies the minimal set of changes necessary to update the DOM nodes (or the platform-specific views in case of React Native).&lt;/p&gt;
&lt;p&gt;This gradual refining process is also the reason React apps are easy to optimize. If some parts of your component tree become too large for React to visit efficiently, you can tell it to &lt;a href=&quot;/react/docs/advanced-performance.html&quot;&gt;skip this “refining” and diffing certain parts of the tree if the relevant props have not changed&lt;/a&gt;. It is very fast to calculate whether the props have changed if they are immutable, so React and immutability work great together, and can provide great optimizations with the minimal effort.&lt;/p&gt;
&lt;p&gt;You might have noticed that this blog entry talks a lot about components and elements, and not so much about the instances. The truth is, instances have much less importance in React than in most object-oriented UI frameworks.&lt;/p&gt;
&lt;p&gt;Only components declared as classes have instances, and you never create them directly: React does that for you. While &lt;a href=&quot;/react/docs/more-about-refs.html&quot;&gt;mechanisms for a parent component instance to access a child component instance&lt;/a&gt; exist, they are only used for imperative actions (such as setting focus on a field), and should generally be avoided.&lt;/p&gt;
&lt;p&gt;React takes care of creating an instance for every class component, so you can write components in an object-oriented way with methods and local state, but other than that, instances are not very important in the Reacts programming model and are managed by React itself.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;summary&quot;&gt;&lt;/a&gt;Summary &lt;a class=&quot;hash-link&quot; href=&quot;#summary&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;An &lt;em&gt;element&lt;/em&gt; is a plain object describing what you want to appear on the screen in terms of the DOM nodes or other components. Elements can contain other elements in their props. Creating a React element is cheap. Once an element is created, it is never mutated.&lt;/p&gt;
&lt;p&gt;A &lt;em&gt;component&lt;/em&gt; can be declared in several different ways. It can be a class with a &lt;code&gt;render()&lt;/code&gt; method. Alternatively, in simple cases, it can be defined as a function. In either case, it takes props as an input, and returns an element tree as the output.&lt;/p&gt;
&lt;p&gt;When a component receives some props as an input, it is because a particular parent component returned an element with its &lt;code&gt;type&lt;/code&gt; and these props. This is why people say that the props flows one way in React: from parents to children.&lt;/p&gt;
&lt;p&gt;An &lt;em&gt;instance&lt;/em&gt; is what you refer to as &lt;code&gt;this&lt;/code&gt; in the component class you write. It is useful for &lt;a href=&quot;/react/docs/component-api.html&quot;&gt;storing local state and reacting to the lifecycle events&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Functional components dont have instances at all. Class components have instances, but you never need to create a component instance directly—React takes care of this.&lt;/p&gt;
&lt;p&gt;Finally, to create elements, use &lt;a href=&quot;/react/docs/top-level-api.html#react.createelement&quot;&gt;&lt;code&gt;React.createElement()&lt;/code&gt;&lt;/a&gt;, &lt;a href=&quot;/react/docs/jsx-in-depth.html&quot;&gt;JSX&lt;/a&gt;, or an &lt;a href=&quot;/react/docs/top-level-api.html#react.createfactory&quot;&gt;element factory helper&lt;/a&gt;. Dont write elements as plain objects in the real code—just know that they are plain objects under the hood.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;further-reading&quot;&gt;&lt;/a&gt;Further Reading &lt;a class=&quot;hash-link&quot; href=&quot;#further-reading&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;/react/blog/2014/10/14/introducing-react-elements.html&quot;&gt;Introducing React Elements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/react/blog/2015/02/24/streamlining-react-elements.html&quot;&gt;Streamlining React Elements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;/react/docs/glossary.html&quot;&gt;React (Virtual) DOM Terminology&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;footnotes&quot;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&quot;fn1&quot;&gt;
&lt;p&gt;All React elements require an additional &lt;code&gt;$$typeof: Symbol.for(&amp;#39;react.element&amp;#39;)&lt;/code&gt; field declared on the object for &lt;a href=&quot;https://github.com/facebook/react/pull/4832&quot;&gt;security reasons&lt;/a&gt;. It is omitted in the examples above. This blog entry uses inline objects for elements to give you an idea of whats happening underneath but the code wont run as is unless you either add &lt;code&gt;$$typeof&lt;/code&gt; to the elements, or change the code to use &lt;code&gt;React.createElement()&lt;/code&gt; or JSX.&amp;nbsp;&lt;a href=&quot;#fnref1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
<pubDate>2015-12-18T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html</guid>
</item>
<item>
<title>isMounted is an Antipattern</title>
<description>&lt;p&gt;As we move closer to officially deprecating isMounted, it&amp;#39;s worth understanding why the function is an antipattern, and how to write code without the isMounted function.&lt;/p&gt;
&lt;p&gt;The primary use case for &lt;code&gt;isMounted()&lt;/code&gt; is to avoid calling &lt;code&gt;setState()&lt;/code&gt; after a component has unmounted, because calling &lt;code&gt;setState()&lt;/code&gt; after a component has unmounted will emit a warning. The “setState warning” exists to help you catch bugs, because calling &lt;code&gt;setState()&lt;/code&gt; on an unmounted component is an indication that your app/component has somehow failed to clean up properly. Specifically, calling &lt;code&gt;setState()&lt;/code&gt; in an unmounted component means that your app is still holding a reference to the component after the component has been unmounted - which often indicates a memory leak!&lt;/p&gt;
&lt;p&gt;To avoid the error message, people often add lines like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isMounted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// This is bad.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({...});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Checking &lt;code&gt;isMounted&lt;/code&gt; before calling &lt;code&gt;setState()&lt;/code&gt; does eliminate the warning, but it also defeats the purpose of the warning, since now you will never get the warning (even when you should!)&lt;/p&gt;
&lt;p&gt;Other uses of &lt;code&gt;isMounted()&lt;/code&gt; are similarly erroneous; using &lt;code&gt;isMounted()&lt;/code&gt; is a code smell because the only reason you would check is because you think you might be holding a reference after the component has unmounted.&lt;/p&gt;
&lt;p&gt;An easy migration strategy for anyone upgrading their code to avoid &lt;code&gt;isMounted()&lt;/code&gt; is to track the mounted status yourself. Just set a &lt;code&gt;_isMounted&lt;/code&gt; property to true in &lt;code&gt;componentDidMount&lt;/code&gt; and set it to false in &lt;code&gt;componentWillUnmount&lt;/code&gt;, and use this variable to check your component&amp;#39;s status.&lt;/p&gt;
&lt;p&gt;An optimal solution would be to find places where &lt;code&gt;setState()&lt;/code&gt; might be called after a component has unmounted, and fix them. Such situations most commonly occur due to callbacks, when a component is waiting for some data and gets unmounted before the data arrives. Ideally, any callbacks should be canceled in &lt;code&gt;componentWillUnmount&lt;/code&gt;, prior to unmounting.&lt;/p&gt;
&lt;p&gt;For instance, if you are using a Flux store in your component, you must unsubscribe in &lt;code&gt;componentWillUnmount&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MyComponent&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Component&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;componentDidMount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;mydatastore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;componentWillUnmount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt; &lt;span class=&quot;nx&quot;&gt;mydatastore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;unsubscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you use ES6 promises, you may need to wrap your promise in order to make it cancelable.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;cancelablePromise&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;makeCancelable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({...}}))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;cancelablePromise&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;promise&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;resolved&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;isCanceled&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;reason&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isCanceled&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;cancelablePromise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cancel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Cancel the promise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Where &lt;code&gt;makeCancelable&lt;/code&gt; is &lt;a href=&quot;https://github.com/facebook/react/issues/5465#issuecomment-157888325&quot;&gt;defined by @istarkov&lt;/a&gt; as:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;makeCancelable&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasCanceled_&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;promise&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Promise&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;reject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;promise&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hasCanceled_&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;reject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isCanceled&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;cancel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;hasCanceled_&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As an added bonus for getting your code cleaned up early, getting rid of &lt;code&gt;isMounted()&lt;/code&gt; makes it one step easier for you to upgrade to ES6 classes, where using &lt;code&gt;isMounted()&lt;/code&gt; is already prohibited. Happy coding!&lt;/p&gt;
</description>
<pubDate>2015-12-16T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/16/ismounted-antipattern.html</guid>
</item>
<item>
<title>React.js Conf 2016 Diversity Scholarship</title>
<description>&lt;p&gt;I am thrilled to announced that we will be organizing another diversity scholarship program for the upcoming React.js Conf! The tech industry is suffering from a lack of diversity, but it&amp;#39;s important to us that we have a thriving community that is made up of people with a variety of experiences and viewpoints.&lt;/p&gt;
&lt;p&gt;When we ran this program last year, we had &lt;em&gt;over 200&lt;/em&gt; people apply for only 10 tickets. There were so many people that we wanted to bring in but we couldn&amp;#39;t. The results were still awesome, and we had bright individuals from around the world attending who would have otherwise been unable to. These attendees took part in discussions at the conference and brought perspectives that we might not have otherwise seen there.&lt;/p&gt;
&lt;p&gt;This year we&amp;#39;re excited to bring back the scholarship, but we&amp;#39;ve set aside &lt;strong&gt;40 tickets&lt;/strong&gt; because we really believe that it&amp;#39;s important to do our best to make sure we have an even more diverse audience.&lt;/p&gt;
&lt;p&gt;This is something I&amp;#39;m personally really excited to be a part of. I know the rest of the team is as well. We&amp;#39;re really proud to have everyone at Facebook providing support and funding for this.&lt;/p&gt;
&lt;p&gt;The details of the scholarship are provided below (or you can &lt;a href=&quot;http://goo.gl/forms/PEmKj8oUp4&quot;&gt;go directly to the application&lt;/a&gt;). I encourage you to apply! If you don&amp;#39;t feel like you are eligible yourself, you can still help send this along to friends, family, coworkers, acquaintances, or anybody who might be interested. And even if you haven&amp;#39;t spoken before, please consider &lt;a href=&quot;http://conf.reactjs.com/&quot;&gt;submitting a proposal for a talk&lt;/a&gt; (either 30 minutes or just 5 minutes) - we&amp;#39;re hoping to have a very diverse group of speakers in addition to attendees.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Facebook is excited to announce that we are now accepting applications for the React.js Conf Diversity Scholarship!&lt;/p&gt;
&lt;p&gt;Beginning today, those studying or working in computer science or a related field can apply for a partial scholarship to attend the React.js Conf in San Francisco, CA on February 22 &amp;amp; 23, 2016.&lt;/p&gt;
&lt;p&gt;React opens a world of new possibilities such as server-side rendering, real-time updates, different rendering targets like SVG and canvas. React Native makes is easy to use the same concepts and technologies to build native mobile experiences on iOS and Android. Join us at React.js Conf to shape the future of client-side applications! For more information about the React.js conference, please see &lt;a href=&quot;http://conf.reactjs.com/&quot;&gt;the website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;At Facebook, we believe that anyone anywhere can make a positive impact by developing products to make the world more open and connected to the people and things they care about. Given the current realities of the tech industry and the lack of representation of communities we seek to serve, applicants currently under-represented in Computer Science and related fields are strongly encouraged to apply. Facebook will make determinations on scholarship recipients in its sole discretion. Facebook complies with all equal opportunity laws.&lt;/p&gt;
&lt;p&gt;To apply for the scholarship, please visit the application page: &lt;strong&gt;&lt;a href=&quot;http://goo.gl/forms/PEmKj8oUp4&quot;&gt;http://goo.gl/forms/PEmKj8oUp4&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;award-includes&quot;&gt;&lt;/a&gt;Award Includes &lt;a class=&quot;hash-link&quot; href=&quot;#award-includes&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Paid registration fee for the React.js Conf Feburary 22 &amp;amp; 23 in downtown San Francisco, CA&lt;/li&gt;
&lt;li&gt;Paid lodging expenses for February 21, 22, 23&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;important-dates&quot;&gt;&lt;/a&gt;Important Dates &lt;a class=&quot;hash-link&quot; href=&quot;#important-dates&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Sunday December 13th 2015 - 11:59 PST: Applications for the React.js Conf Scholarship must be submitted in full&lt;/li&gt;
&lt;li&gt;Wednesday, December 16th, 2015: Award recipients will be notified by email of their acceptance&lt;/li&gt;
&lt;li&gt;Monday &amp;amp; Tuesday, February 22 &amp;amp; 23, 2016: React.js Conf&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;eligibility&quot;&gt;&lt;/a&gt;Eligibility &lt;a class=&quot;hash-link&quot; href=&quot;#eligibility&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Must currently be studying or working in Computer Science or a related field&lt;/li&gt;
&lt;li&gt;International applicants are welcome, but you will be responsible for securing your own visa to attend the conference&lt;/li&gt;
&lt;li&gt;You must be able to provide your own transportation to San Francisco&lt;/li&gt;
&lt;li&gt;You must be available to attend the full duration of React.js Conf on February 22 &amp;amp; 23 in San Francisco, CA&lt;/li&gt;
&lt;/ul&gt;
</description>
<pubDate>2015-12-04T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/12/04/react-js-conf-2016-diversity-scholarship.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/12/04/react-js-conf-2016-diversity-scholarship.html</guid>
</item>
<item>
<title>React v0.14.3</title>
<description>&lt;p&gt;It&amp;#39;s time for another installment of React patch releases! We didn&amp;#39;t break anything in v0.14.2 but we do have a couple of other bugs we&amp;#39;re fixing. The biggest change in this release is actually an addition of a new built file. We heard from a number of people that they still need the ability to use React to render to a string on the client. While the use cases are not common and there are other ways to achieve this, we decided that it&amp;#39;s still valuable to support. So we&amp;#39;re now building &lt;code&gt;react-dom-server.js&lt;/code&gt;, which will be shipped to Bower and in the &lt;code&gt;dist/&lt;/code&gt; directory of the &lt;code&gt;react-dom&lt;/code&gt; package on npm. This file works the same way as &lt;code&gt;react-dom.js&lt;/code&gt; and therefore requires that the primary React build has already been included on the page.&lt;/p&gt;
&lt;p&gt;The release is now available for download:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-0.14.3.js&quot;&gt;https://fb.me/react-0.14.3.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-0.14.3.min.js&quot;&gt;https://fb.me/react-0.14.3.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React with Add-Ons&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.3.js&quot;&gt;https://fb.me/react-with-addons-0.14.3.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.3.min.js&quot;&gt;https://fb.me/react-with-addons-0.14.3.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM&lt;/strong&gt; (include React in the page before React DOM)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-0.14.3.js&quot;&gt;https://fb.me/react-dom-0.14.3.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-0.14.3.min.js&quot;&gt;https://fb.me/react-dom-0.14.3.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM Server&lt;/strong&gt; (include React in the page before React DOM Server)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-server-0.14.3.js&quot;&gt;https://fb.me/react-dom-server-0.14.3.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-server-0.14.3.min.js&quot;&gt;https://fb.me/react-dom-server-0.14.3.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We&amp;#39;ve also published version &lt;code&gt;0.14.3&lt;/code&gt; of the &lt;code&gt;react&lt;/code&gt;, &lt;code&gt;react-dom&lt;/code&gt;, and addons packages on npm and the &lt;code&gt;react&lt;/code&gt; package on bower.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;changelog&quot;&gt;&lt;/a&gt;Changelog &lt;a class=&quot;hash-link&quot; href=&quot;#changelog&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-dom&quot;&gt;&lt;/a&gt;React DOM &lt;a class=&quot;hash-link&quot; href=&quot;#react-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Added support for &lt;code&gt;nonce&lt;/code&gt; attribute for &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; elements&lt;/li&gt;
&lt;li&gt;Added support for &lt;code&gt;reversed&lt;/code&gt; attribute for &lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt; elements&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-testutils-add-on&quot;&gt;&lt;/a&gt;React TestUtils Add-on &lt;a class=&quot;hash-link&quot; href=&quot;#react-testutils-add-on&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fixed bug with shallow rendering and function refs&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-csstransitiongroup-add-on&quot;&gt;&lt;/a&gt;React CSSTransitionGroup Add-on &lt;a class=&quot;hash-link&quot; href=&quot;#react-csstransitiongroup-add-on&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fixed bug resulting in timeouts firing incorrectly when mounting and unmounting rapidly&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-on-bower&quot;&gt;&lt;/a&gt;React on Bower &lt;a class=&quot;hash-link&quot; href=&quot;#react-on-bower&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;react-dom-server.js&lt;/code&gt; to expose &lt;code&gt;renderToString&lt;/code&gt; and &lt;code&gt;renderToStaticMarkup&lt;/code&gt; for usage in the browser&lt;/li&gt;
&lt;/ul&gt;
</description>
<pubDate>2015-11-18T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/11/18/react-v0.14.3.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/11/18/react-v0.14.3.html</guid>
</item>
<item>
<title>React v0.14.2</title>
<description>&lt;p&gt;We have a quick update following the release of 0.14.1 last week. It turns out we broke a couple things in the development build of React when using Internet Explorer. Luckily it was only the development build, so your production applications were unaffected. This release is mostly to address those issues. There is one notable change if consuming React from npm. For the &lt;code&gt;react-dom&lt;/code&gt; package, we moved &lt;code&gt;react&lt;/code&gt; from a regular dependency to a peer dependency. This will impact very few people as these two are typically installed together at the top level, but it will fix some issues with dependencies of installed components also using &lt;code&gt;react&lt;/code&gt; as a peer dependency.&lt;/p&gt;
&lt;p&gt;The release is now available for download:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-0.14.2.js&quot;&gt;https://fb.me/react-0.14.2.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-0.14.2.min.js&quot;&gt;https://fb.me/react-0.14.2.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React with Add-Ons&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.2.js&quot;&gt;https://fb.me/react-with-addons-0.14.2.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.2.min.js&quot;&gt;https://fb.me/react-with-addons-0.14.2.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM&lt;/strong&gt; (include React in the page before React DOM)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-0.14.2.js&quot;&gt;https://fb.me/react-dom-0.14.2.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-0.14.2.min.js&quot;&gt;https://fb.me/react-dom-0.14.2.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We&amp;#39;ve also published version &lt;code&gt;0.14.2&lt;/code&gt; of the &lt;code&gt;react&lt;/code&gt;, &lt;code&gt;react-dom&lt;/code&gt;, and addons packages on npm and the &lt;code&gt;react&lt;/code&gt; package on bower.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;changelog&quot;&gt;&lt;/a&gt;Changelog &lt;a class=&quot;hash-link&quot; href=&quot;#changelog&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-dom&quot;&gt;&lt;/a&gt;React DOM &lt;a class=&quot;hash-link&quot; href=&quot;#react-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fixed bug with development build preventing events from firing in some versions of Internet Explorer &amp;amp; Edge&lt;/li&gt;
&lt;li&gt;Fixed bug with development build when using es5-sham in older versions of Internet Explorer&lt;/li&gt;
&lt;li&gt;Added support for &lt;code&gt;integrity&lt;/code&gt; attribute&lt;/li&gt;
&lt;li&gt;Fixed bug resulting in &lt;code&gt;children&lt;/code&gt; prop being coerced to a string for custom elements, which was not the desired behavior.&lt;/li&gt;
&lt;li&gt;Moved &lt;code&gt;react&lt;/code&gt; from &lt;code&gt;dependencies&lt;/code&gt; to &lt;code&gt;peerDependencies&lt;/code&gt; to match expectations and align with &lt;code&gt;react-addons-*&lt;/code&gt; packages&lt;/li&gt;
&lt;/ul&gt;
</description>
<pubDate>2015-11-02T00:00:00-08:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/11/02/react-v0.14.2.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/11/02/react-v0.14.2.html</guid>
</item>
<item>
<title>React v0.14.1</title>
<description>&lt;p&gt;After a couple weeks of having more people use v0.14, we&amp;#39;re ready to ship a patch release addressing a few issues. Thanks to everybody who has reported issues and written patches!&lt;/p&gt;
&lt;p&gt;The release is now available for download:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-0.14.1.js&quot;&gt;https://fb.me/react-0.14.1.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-0.14.1.min.js&quot;&gt;https://fb.me/react-0.14.1.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React with Add-Ons&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.1.js&quot;&gt;https://fb.me/react-with-addons-0.14.1.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.1.min.js&quot;&gt;https://fb.me/react-with-addons-0.14.1.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM&lt;/strong&gt; (include React in the page before React DOM)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-0.14.1.js&quot;&gt;https://fb.me/react-dom-0.14.1.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-0.14.1.min.js&quot;&gt;https://fb.me/react-dom-0.14.1.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We&amp;#39;ve also published version &lt;code&gt;0.14.1&lt;/code&gt; of the &lt;code&gt;react&lt;/code&gt;, &lt;code&gt;react-dom&lt;/code&gt;, and addons packages on npm and the &lt;code&gt;react&lt;/code&gt; package on bower.&lt;/p&gt;
&lt;hr&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;changelog&quot;&gt;&lt;/a&gt;Changelog &lt;a class=&quot;hash-link&quot; href=&quot;#changelog&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-dom&quot;&gt;&lt;/a&gt;React DOM &lt;a class=&quot;hash-link&quot; href=&quot;#react-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fixed bug where events wouldn&amp;#39;t fire in old browsers when using React in development mode&lt;/li&gt;
&lt;li&gt;Fixed bug preventing use of &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt; with Closure Compiler Advanced mode&lt;/li&gt;
&lt;li&gt;Added support for &lt;code&gt;srcLang&lt;/code&gt;, &lt;code&gt;default&lt;/code&gt;, and &lt;code&gt;kind&lt;/code&gt; attributes for &lt;code&gt;&amp;lt;track&amp;gt;&lt;/code&gt; elements&lt;/li&gt;
&lt;li&gt;Added support for &lt;code&gt;color&lt;/code&gt; attribute&lt;/li&gt;
&lt;li&gt;Ensured legacy &lt;code&gt;.props&lt;/code&gt; access on DOM nodes is updated on re-renders&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-testutils-add-on&quot;&gt;&lt;/a&gt;React TestUtils Add-on &lt;a class=&quot;hash-link&quot; href=&quot;#react-testutils-add-on&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fixed &lt;code&gt;scryRenderedDOMComponentsWithClass&lt;/code&gt; so it works with SVG&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-csstransitiongroup-add-on&quot;&gt;&lt;/a&gt;React CSSTransitionGroup Add-on &lt;a class=&quot;hash-link&quot; href=&quot;#react-csstransitiongroup-add-on&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fix bug preventing &lt;code&gt;0&lt;/code&gt; to be used as a timeout value&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-on-bower&quot;&gt;&lt;/a&gt;React on Bower &lt;a class=&quot;hash-link&quot; href=&quot;#react-on-bower&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;react-dom.js&lt;/code&gt; to &lt;code&gt;main&lt;/code&gt; to improve compatibility with tooling&lt;/li&gt;
&lt;/ul&gt;
</description>
<pubDate>2015-10-28T00:00:00-07:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/10/28/react-v0.14.1.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/10/28/react-v0.14.1.html</guid>
</item>
<item>
<title>Reactiflux is moving to Discord</title>
<description>&lt;p&gt;TL;DR: Slack decided that Reactiflux had too many members and disabled new invites. Reactiflux is moving to Discord. Join us: &lt;a href=&quot;http://join.reactiflux.com/&quot;&gt;http://join.reactiflux.com&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;what-happened-with-slack&quot;&gt;&lt;/a&gt;What happened with Slack? &lt;a class=&quot;hash-link&quot; href=&quot;#what-happened-with-slack&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A few weeks ago, Reactiflux reached 7,500 members on Slack. Shortly after, Slack decided we were too big and disabled invites. There was no way for new users to join. Many of us were sad and upset. We loved Slack. Our community was built around it.&lt;/p&gt;
&lt;p&gt;We reached out to Slack several times, but their decision was firm. Our large community caused performance issues. Slack wants to focus on building a great product for teams, not necessarily large open communities. Losing focus and building for too many use cases always leads to product bloat, and eventually a decrease in quality.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;so-why-discord&quot;&gt;&lt;/a&gt;So… why Discord? &lt;a class=&quot;hash-link&quot; href=&quot;#so-why-discord&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;After a &lt;a href=&quot;https://github.com/reactiflux/volunteers/issues/25&quot;&gt;long and thorough debate&lt;/a&gt;, Discord quickly emerged as the most promising service. After just a few days, 400 members had joined the Discord server, and many already loved it.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;easiest-to-join&quot;&gt;&lt;/a&gt;Easiest to join &lt;a class=&quot;hash-link&quot; href=&quot;#easiest-to-join&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Discord is the easiest platform to join. New users can immediately join our conversations without having to create an account. All they need to do is provide a name. No permission granting, no password, no email confirmation.&lt;/p&gt;
&lt;p&gt;This is critically useful for us, and will make Reactiflux even more open and accessible.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;great-apps&quot;&gt;&lt;/a&gt;Great apps &lt;a class=&quot;hash-link&quot; href=&quot;#great-apps&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Out of all of the services weve tried, Discords apps are by far the most polished. They are well designed, easy to use, and surprisingly fast. In addition to the web app, they have mobile apps on both iOS and Android as well as desktop apps for OS X and Windows, with Linux support coming soon.&lt;/p&gt;
&lt;p&gt;Their desktop apps are built with React and Electron, and their iOS app is built with React Native.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;moderation-tools&quot;&gt;&lt;/a&gt;Moderation tools &lt;a class=&quot;hash-link&quot; href=&quot;#moderation-tools&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;So far, weve been fortunate not to have to deal with spammers and trolls. As our community continues to grow, that might change. Unsurprisingly, Discord is the only app weve seen with legitimate moderation tools. It was built for gaming communities, after all.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;great-multiple-server-support&quot;&gt;&lt;/a&gt;Great multiple Server support &lt;a class=&quot;hash-link&quot; href=&quot;#great-multiple-server-support&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Your Discord account works with every Discord server, which is the equivalent of a Slack team. You dont need to create a new account every time you join a new team. You can join new servers in one click, and its very easy to switch between them. Discord messages also work across servers, so your personal conversations are not scoped to a single server.&lt;/p&gt;
&lt;p&gt;Instead of having one huge, crowded Reactiflux server, we can branch off closely related channels into sub-servers. Communities will start overlapping, and it will be easy to interact with non-Reactiflux channels.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;its-hosted&quot;&gt;&lt;/a&gt;Its hosted &lt;a class=&quot;hash-link&quot; href=&quot;#its-hosted&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Self-hosted apps require maintenance. Were all busy, and we can barely find the time to keep our landing page up to date and running smoothly. More than anything, we need a stable platform, and we dont have the resources to guarantee that right now.&lt;/p&gt;
&lt;p&gt;Its a much safer bet to offload the hosting to Discord, who is already keeping the lights on for all their users.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;we-like-the-team&quot;&gt;&lt;/a&gt;We like the team &lt;a class=&quot;hash-link&quot; href=&quot;#we-like-the-team&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;And they seem to like us back. They are excited for us to join them, and theyve been very responsive to our feedback and suggestions.&lt;/p&gt;
&lt;p&gt;They implemented code syntax highlighting just a few days after we told them we needed it.&lt;/p&gt;
&lt;p&gt;Discords team has already built a solid suite of apps, and they have shown us how much they care about their users. Were excited to see how they will continue to improve their product.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;and-whats-the-catch&quot;&gt;&lt;/a&gt;And whats the catch? &lt;a class=&quot;hash-link&quot; href=&quot;#and-whats-the-catch&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Choosing the best chat service is subjective. There are a million reasons why Discord &lt;em&gt;might be&lt;/em&gt; a terrible idea. Here are the ones that were most worried about:&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;difficult-channel-management&quot;&gt;&lt;/a&gt;Difficult channel management &lt;a class=&quot;hash-link&quot; href=&quot;#difficult-channel-management&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Channel management seems to be the biggest issue. There is no way to opt out of channels; you can only mute them. And you can only mute channels one by one. There is no way to star channels, and channels can only be sorted on the server level. Each user will see the list of channels in the same order.&lt;/p&gt;
&lt;p&gt;As the number of channels grow, it will be challenging to keep things in order. Branching off sub-servers will help, and we will keep an easily accessible directory of channels across our main server and all of the sub-servers.&lt;/p&gt;
&lt;p&gt;We can build simple tools to make channel lookup easier, and the Discord team is working on improvements that should make this more manageable.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;no-search&quot;&gt;&lt;/a&gt;No Search &lt;a class=&quot;hash-link&quot; href=&quot;#no-search&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Lack of search is clearly a bummer, but Discord is working on it. Search is coming!&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;firewall&quot;&gt;&lt;/a&gt;Firewall &lt;a class=&quot;hash-link&quot; href=&quot;#firewall&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A couple of users arent able to access Discord at work since other corporate filters classify it as a gaming application. This sucks, but it seems to be a rare case. So far, it seems only to affect 0.6% of our current community (3/500).&lt;/p&gt;
&lt;p&gt;We hope that these users can get Discord&amp;#39;s domains whitelisted, and well try to find a solution if this is a widespread issue. The Discord team is aware of the issue as well.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;is-discord-going-to-disappear-tomorrow&quot;&gt;&lt;/a&gt;Is Discord going to disappear tomorrow? &lt;a class=&quot;hash-link&quot; href=&quot;#is-discord-going-to-disappear-tomorrow&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Probably not tomorrow. They have 14 people &lt;a href=&quot;https://discordapp.com/company&quot;&gt;full time&lt;/a&gt;, and theyve raised money from some of the best investors in Silicon Valley, including &lt;a href=&quot;http://www.benchmark.com/&quot;&gt;Benchmark&lt;/a&gt; and &lt;a href=&quot;http://www.accel.com/companies/&quot;&gt;Accel&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By focusing on gaming communities, Discord has differentiated itself from the many other communication apps. Discord is well received and has a rapidly growing user base. They plan to keep their basic offerings free for unlimited users and hope to make money with premium offerings (themes, add-ons, content, and more).&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;join-us&quot;&gt;&lt;/a&gt;Join us! &lt;a class=&quot;hash-link&quot; href=&quot;#join-us&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;More than 500 of us have already migrated to the new Reactiflux. Join us, we&amp;#39;re one click away: &lt;a href=&quot;http://join.reactiflux.com/&quot;&gt;http://join.reactiflux.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: Jordan Hawkers thorough &lt;a href=&quot;http://jhawk.co/team-chat-comparison&quot;&gt;research&lt;/a&gt; made our decision a lot easier.&lt;/em&gt;&lt;/p&gt;
</description>
<pubDate>2015-10-19T00:00:00-07:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/10/19/reactiflux-is-moving-to-discord.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/10/19/reactiflux-is-moving-to-discord.html</guid>
</item>
<item>
<title>React v0.14</title>
<description>&lt;p&gt;Were happy to announce the release of React 0.14 today! This release has a few major changes, primarily designed to simplify the code you write every day and to better support environments like React Native.&lt;/p&gt;
&lt;p&gt;If you tried the release candidate, thank you your support is invaluable and we&amp;#39;ve fixed a few bugs that you reported.&lt;/p&gt;
&lt;p&gt;As with all of our releases, we consider this version to be stable enough to use in production and recommend that you upgrade in order to take advantage of our latest improvements.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;upgrade-guide&quot;&gt;&lt;/a&gt;Upgrade Guide &lt;a class=&quot;hash-link&quot; href=&quot;#upgrade-guide&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Like always, we have a few breaking changes in this release. We know changes can be painful (the Facebook codebase has over 15,000 React components), so we always try to make changes gradually in order to minimize the pain.&lt;/p&gt;
&lt;p&gt;If your code is free of warnings when running under React 0.13, upgrading should be easy. We have two new small breaking changes that didn&amp;#39;t give a warning in 0.13 (see below). Every new change in 0.14, including the major changes below, is introduced with a runtime warning and will work as before until 0.15, so you don&amp;#39;t have to worry about your app breaking with this upgrade.&lt;/p&gt;
&lt;p&gt;For the two major changes which require significant code changes, we&amp;#39;ve included &lt;a href=&quot;https://github.com/reactjs/react-codemod/blob/master/README.md&quot;&gt;codemod scripts&lt;/a&gt; to help you upgrade your code automatically.&lt;/p&gt;
&lt;p&gt;See the changelog below for more details.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;installation&quot;&gt;&lt;/a&gt;Installation &lt;a class=&quot;hash-link&quot; href=&quot;#installation&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We recommend using React from &lt;code&gt;npm&lt;/code&gt; and using a tool like browserify or webpack to build your code into a single bundle. To install the two packages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;npm install --save react react-dom&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Remember that by default, React runs extra checks and provides helpful warnings in development mode. When deploying your app, set the &lt;code&gt;NODE_ENV&lt;/code&gt; environment variable to &lt;code&gt;production&lt;/code&gt; to use the production build of React which does not include the development warnings and runs significantly faster.&lt;/p&gt;
&lt;p&gt;If you cant use &lt;code&gt;npm&lt;/code&gt; yet, we provide pre-built browser builds for your convenience, which are also available in the &lt;code&gt;react&lt;/code&gt; package on bower.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-0.14.0.js&quot;&gt;https://fb.me/react-0.14.0.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-0.14.0.min.js&quot;&gt;https://fb.me/react-0.14.0.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React with Add-Ons&lt;/strong&gt;&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.0.js&quot;&gt;https://fb.me/react-with-addons-0.14.0.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.0.min.js&quot;&gt;https://fb.me/react-with-addons-0.14.0.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;React DOM&lt;/strong&gt; (include React in the page before React DOM)&lt;br&gt;
Dev build with warnings: &lt;a href=&quot;https://fb.me/react-dom-0.14.0.js&quot;&gt;https://fb.me/react-dom-0.14.0.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-0.14.0.min.js&quot;&gt;https://fb.me/react-dom-0.14.0.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;changelog&quot;&gt;&lt;/a&gt;Changelog &lt;a class=&quot;hash-link&quot; href=&quot;#changelog&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;major-changes&quot;&gt;&lt;/a&gt;Major changes &lt;a class=&quot;hash-link&quot; href=&quot;#major-changes&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;two-packages-react-and-react-dom&quot;&gt;&lt;/a&gt;Two Packages: React and React DOM &lt;a class=&quot;hash-link&quot; href=&quot;#two-packages-react-and-react-dom&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;As we look at packages like &lt;a href=&quot;https://github.com/facebook/react-native&quot;&gt;react-native&lt;/a&gt;, &lt;a href=&quot;https://github.com/reactjs/react-art&quot;&gt;react-art&lt;/a&gt;, &lt;a href=&quot;https://github.com/Flipboard/react-canvas&quot;&gt;react-canvas&lt;/a&gt;, and &lt;a href=&quot;https://github.com/Izzimach/react-three&quot;&gt;react-three&lt;/a&gt;, it has become clear that the beauty and essence of React has nothing to do with browsers or the DOM.&lt;/p&gt;
&lt;p&gt;To make this more clear and to make it easier to build more environments that React can render to, were splitting the main &lt;code&gt;react&lt;/code&gt; package into two: &lt;code&gt;react&lt;/code&gt; and &lt;code&gt;react-dom&lt;/code&gt;. &lt;strong&gt;This paves the way to writing components that can be shared between the web version of React and React Native.&lt;/strong&gt; We dont expect all the code in an app to be shared, but we want to be able to share the components that do behave the same across platforms.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;react&lt;/code&gt; package contains &lt;code&gt;React.createElement&lt;/code&gt;, &lt;code&gt;.createClass&lt;/code&gt;, &lt;code&gt;.Component&lt;/code&gt;, &lt;code&gt;.PropTypes&lt;/code&gt;, &lt;code&gt;.Children&lt;/code&gt;, and the other helpers related to elements and component classes. We think of these as the &lt;a href=&quot;http://nerds.airbnb.com/isomorphic-javascript-future-web-apps/&quot;&gt;&lt;em&gt;isomorphic&lt;/em&gt;&lt;/a&gt; or &lt;a href=&quot;https://medium.com/@mjackson/universal-javascript-4761051b7ae9&quot;&gt;&lt;em&gt;universal&lt;/em&gt;&lt;/a&gt; helpers that you need to build components.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;react-dom&lt;/code&gt; package has &lt;code&gt;ReactDOM.render&lt;/code&gt;, &lt;code&gt;.unmountComponentAtNode&lt;/code&gt;, and &lt;code&gt;.findDOMNode&lt;/code&gt;. In &lt;code&gt;react-dom/server&lt;/code&gt; we have server-side rendering support with &lt;code&gt;ReactDOMServer.renderToString&lt;/code&gt; and &lt;code&gt;.renderToStaticMarkup&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;react&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;react-dom&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MyComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Hello&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;World&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/div&amp;gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;ReactDOM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;MyComponent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;node&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The old names will continue to work with a warning until 0.15 is released, and weve published the &lt;a href=&quot;https://github.com/reactjs/react-codemod/blob/master/README.md&quot;&gt;automated codemod script&lt;/a&gt; we used at Facebook to help you with this transition.&lt;/p&gt;
&lt;p&gt;The add-ons have moved to separate packages as well:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;react-addons-clone-with-props&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-create-fragment&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-css-transition-group&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-linked-state-mixin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-perf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-pure-render-mixin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-shallow-compare&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-test-utils&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-transition-group&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;react-addons-update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ReactDOM.unstable_batchedUpdates&lt;/code&gt; in &lt;code&gt;react-dom&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For now, please use matching versions of &lt;code&gt;react&lt;/code&gt; and &lt;code&gt;react-dom&lt;/code&gt; (and the add-ons, if you use them) in your apps to avoid versioning problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;dom-node-refs&quot;&gt;&lt;/a&gt;DOM node refs &lt;a class=&quot;hash-link&quot; href=&quot;#dom-node-refs&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The other big change were making in this release is exposing refs to DOM components as the DOM node itself. That means: we looked at what you can do with a &lt;code&gt;ref&lt;/code&gt; to a React DOM component and realized that the only useful thing you can do with it is call &lt;code&gt;this.refs.giraffe.getDOMNode()&lt;/code&gt; to get the underlying DOM node. Starting with this release, &lt;code&gt;this.refs.giraffe&lt;/code&gt; &lt;em&gt;is&lt;/em&gt; the actual DOM node. &lt;strong&gt;Note that refs to custom (user-defined) components work exactly as before; only the built-in DOM components are affected by this change.&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Zoo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;render&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Giraffe&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;giraffe&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/div&amp;gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;showName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Previously: var input = this.refs.giraffe.getDOMNode();&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;refs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;giraffe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This change also applies to the return result of &lt;code&gt;ReactDOM.render&lt;/code&gt; when passing a DOM node as the top component. As with refs, this change does not affect custom components.&lt;/p&gt;
&lt;p&gt;With this change, were deprecating &lt;code&gt;.getDOMNode()&lt;/code&gt; and replacing it with &lt;code&gt;ReactDOM.findDOMNode&lt;/code&gt; (see below). If your components are currently using &lt;code&gt;.getDOMNode()&lt;/code&gt;, they will continue to work with a warning until 0.15.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;stateless-functional-components&quot;&gt;&lt;/a&gt;Stateless functional components &lt;a class=&quot;hash-link&quot; href=&quot;#stateless-functional-components&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;In idiomatic React code, most of the components you write will be stateless, simply composing other components. Were introducing a new, simpler syntax for these components where you can take &lt;code&gt;props&lt;/code&gt; as an argument and return the element you want to render:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;c1&quot;&gt;// A functional component using an ES2015 (ES6) arrow function:&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Aquarium&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fish&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getFish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;species&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Tank&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/Tank&amp;gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Or with destructuring and an implicit return, simply:&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Aquarium&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;species&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Tank&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getFish&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;species&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/Tank&amp;gt;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// Then use: &amp;lt;Aquarium species=&amp;quot;rainbowfish&amp;quot; /&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;These components behave just like a React class with only a &lt;code&gt;render&lt;/code&gt; method defined. Since no component instance is created for a functional component, any &lt;code&gt;ref&lt;/code&gt; added to one will evaluate to &lt;code&gt;null&lt;/code&gt;. Functional components do not have lifecycle methods, but you can set &lt;code&gt;.propTypes&lt;/code&gt; and &lt;code&gt;.defaultProps&lt;/code&gt; as properties on the function.&lt;/p&gt;
&lt;p&gt;This pattern is designed to encourage the creation of these simple components that should comprise large portions of your apps. In the future, well also be able to make performance optimizations specific to these components by avoiding unnecessary checks and memory allocations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;deprecation-of-react-tools&quot;&gt;&lt;/a&gt;Deprecation of react-tools &lt;a class=&quot;hash-link&quot; href=&quot;#deprecation-of-react-tools&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;The &lt;code&gt;react-tools&lt;/code&gt; package and &lt;code&gt;JSXTransformer.js&lt;/code&gt; browser file &lt;a href=&quot;/react/blog/2015/06/12/deprecating-jstransform-and-react-tools.html&quot;&gt;have been deprecated&lt;/a&gt;. You can continue using version &lt;code&gt;0.13.3&lt;/code&gt; of both, but we no longer support them and recommend migrating to &lt;a href=&quot;http://babeljs.io/&quot;&gt;Babel&lt;/a&gt;, which has built-in support for React and JSX.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;compiler-optimizations&quot;&gt;&lt;/a&gt;Compiler optimizations &lt;a class=&quot;hash-link&quot; href=&quot;#compiler-optimizations&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;React now supports two compiler optimizations that can be enabled in Babel 5.8.24 and newer. Both of these transforms &lt;strong&gt;should be enabled only in production&lt;/strong&gt; (e.g., just before minifying your code) because although they improve runtime performance, they make warning messages more cryptic and skip important checks that happen in development mode, including propTypes.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inlining React elements:&lt;/strong&gt; The &lt;code&gt;optimisation.react.inlineElements&lt;/code&gt; transform converts JSX elements to object literals like &lt;code&gt;{type: &amp;#39;div&amp;#39;, props: ...}&lt;/code&gt; instead of calls to &lt;code&gt;React.createElement&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Constant hoisting for React elements:&lt;/strong&gt; The &lt;code&gt;optimisation.react.constantElements&lt;/code&gt; transform hoists element creation to the top level for subtrees that are fully static, which reduces calls to &lt;code&gt;React.createElement&lt;/code&gt; and the resulting allocations. More importantly, it tells React that the subtree hasnt changed so React can completely skip it when reconciling.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;breaking-changes&quot;&gt;&lt;/a&gt;Breaking changes &lt;a class=&quot;hash-link&quot; href=&quot;#breaking-changes&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In almost all cases, we change our APIs gradually and warn for at least one release to give you time to clean up your code. These two breaking changes did not have a warning in 0.13 but should be easy to find and clean up:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;React.initializeTouchEvents&lt;/code&gt; is no longer necessary and has been removed completely. Touch events now work automatically.&lt;/li&gt;
&lt;li&gt;Add-Ons: Due to the DOM node refs change mentioned above, &lt;code&gt;TestUtils.findAllInRenderedTree&lt;/code&gt; and related helpers are no longer able to take a DOM component, only a custom component.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These three breaking changes had a warning in 0.13, so you shouldnt have to do anything if your code is already free of warnings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;props&lt;/code&gt; object is now frozen, so mutating props after creating a component element is no longer supported. In most cases, &lt;a href=&quot;/react/docs/top-level-api.html#react.cloneelement&quot;&gt;&lt;code&gt;React.cloneElement&lt;/code&gt;&lt;/a&gt; should be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.&lt;/li&gt;
&lt;li&gt;Plain objects are no longer supported as React children; arrays should be used instead. You can use the &lt;a href=&quot;/react/docs/create-fragment.html&quot;&gt;&lt;code&gt;createFragment&lt;/code&gt;&lt;/a&gt; helper to migrate, which now returns an array.&lt;/li&gt;
&lt;li&gt;Add-Ons: &lt;code&gt;classSet&lt;/code&gt; has been removed. Use &lt;a href=&quot;https://github.com/JedWatson/classnames&quot;&gt;classnames&lt;/a&gt; instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;new-deprecations-introduced-with-a-warning&quot;&gt;&lt;/a&gt;New deprecations, introduced with a warning &lt;a class=&quot;hash-link&quot; href=&quot;#new-deprecations-introduced-with-a-warning&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Each of these changes will continue to work as before with a new warning until the release of 0.15 so you can upgrade your code gradually.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Due to the DOM node refs change mentioned above, &lt;code&gt;this.getDOMNode()&lt;/code&gt; is now deprecated and &lt;code&gt;ReactDOM.findDOMNode(this)&lt;/code&gt; can be used instead. Note that in most cases, calling &lt;code&gt;findDOMNode&lt;/code&gt; is now unnecessary see the example above in the “DOM node refs” section.&lt;/p&gt;
&lt;p&gt;With each returned DOM node, we&amp;#39;ve added a &lt;code&gt;getDOMNode&lt;/code&gt; method for backwards compatibility that will work with a warning until 0.15. If you have a large codebase, you can use our &lt;a href=&quot;https://github.com/reactjs/react-codemod/blob/master/README.md&quot;&gt;automated codemod script&lt;/a&gt; to change your code automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;setProps&lt;/code&gt; and &lt;code&gt;replaceProps&lt;/code&gt; are now deprecated. Instead, call ReactDOM.render again at the top level with the new props.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ES6 component classes must now extend &lt;code&gt;React.Component&lt;/code&gt; in order to enable stateless function components. The &lt;a href=&quot;/react/blog/2015/01/27/react-v0.13.0-beta-1.html#other-languages&quot;&gt;ES3 module pattern&lt;/a&gt; will continue to work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reusing and mutating a &lt;code&gt;style&lt;/code&gt; object between renders has been deprecated. This mirrors our change to freeze the &lt;code&gt;props&lt;/code&gt; object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add-Ons: &lt;code&gt;cloneWithProps&lt;/code&gt; is now deprecated. Use &lt;a href=&quot;/react/docs/top-level-api.html#react.cloneelement&quot;&gt;&lt;code&gt;React.cloneElement&lt;/code&gt;&lt;/a&gt; instead (unlike &lt;code&gt;cloneWithProps&lt;/code&gt;, &lt;code&gt;cloneElement&lt;/code&gt; does not merge &lt;code&gt;className&lt;/code&gt; or &lt;code&gt;style&lt;/code&gt; automatically; you can merge them manually if needed).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add-Ons: To improve reliability, &lt;code&gt;CSSTransitionGroup&lt;/code&gt; will no longer listen to transition events. Instead, you should specify transition durations manually using props such as &lt;code&gt;transitionEnterTimeout={500}&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;notable-enhancements&quot;&gt;&lt;/a&gt;Notable enhancements &lt;a class=&quot;hash-link&quot; href=&quot;#notable-enhancements&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Added &lt;code&gt;React.Children.toArray&lt;/code&gt; which takes a nested children object and returns a flat array with keys assigned to each child. This helper makes it easier to manipulate collections of children in your &lt;code&gt;render&lt;/code&gt; methods, especially if you want to reorder or slice &lt;code&gt;this.props.children&lt;/code&gt; before passing it down. In addition, &lt;code&gt;React.Children.map&lt;/code&gt; now returns plain arrays too.&lt;/li&gt;
&lt;li&gt;React uses &lt;code&gt;console.error&lt;/code&gt; instead of &lt;code&gt;console.warn&lt;/code&gt; for warnings so that browsers show a full stack trace in the console. (Our warnings appear when you use patterns that will break in future releases and for code that is likely to behave unexpectedly, so we do consider our warnings to be “must-fix” errors.)&lt;/li&gt;
&lt;li&gt;Previously, including untrusted objects as React children &lt;a href=&quot;http://danlec.com/blog/xss-via-a-spoofed-react-element&quot;&gt;could result in an XSS security vulnerability&lt;/a&gt;. This problem should be avoided by properly validating input at the application layer and by never passing untrusted objects around your application code. As an additional layer of protection, &lt;a href=&quot;https://github.com/facebook/react/pull/4832&quot;&gt;React now tags elements&lt;/a&gt; with a specific &lt;a href=&quot;http://www.2ality.com/2014/12/es6-symbols.html&quot;&gt;ES2015 (ES6) &lt;code&gt;Symbol&lt;/code&gt;&lt;/a&gt; in browsers that support it, in order to ensure that React never considers untrusted JSON to be a valid element. If this extra security protection is important to you, you should add a &lt;code&gt;Symbol&lt;/code&gt; polyfill for older browsers, such as the one included by &lt;a href=&quot;http://babeljs.io/docs/usage/polyfill/&quot;&gt;Babels polyfill&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;When possible, React DOM now generates XHTML-compatible markup.&lt;/li&gt;
&lt;li&gt;React DOM now supports these standard HTML attributes: &lt;code&gt;capture&lt;/code&gt;, &lt;code&gt;challenge&lt;/code&gt;, &lt;code&gt;inputMode&lt;/code&gt;, &lt;code&gt;is&lt;/code&gt;, &lt;code&gt;keyParams&lt;/code&gt;, &lt;code&gt;keyType&lt;/code&gt;, &lt;code&gt;minLength&lt;/code&gt;, &lt;code&gt;summary&lt;/code&gt;, &lt;code&gt;wrap&lt;/code&gt;. It also now supports these non-standard attributes: &lt;code&gt;autoSave&lt;/code&gt;, &lt;code&gt;results&lt;/code&gt;, &lt;code&gt;security&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;React DOM now supports these SVG attributes, which render into namespaced attributes: &lt;code&gt;xlinkActuate&lt;/code&gt;, &lt;code&gt;xlinkArcrole&lt;/code&gt;, &lt;code&gt;xlinkHref&lt;/code&gt;, &lt;code&gt;xlinkRole&lt;/code&gt;, &lt;code&gt;xlinkShow&lt;/code&gt;, &lt;code&gt;xlinkTitle&lt;/code&gt;, &lt;code&gt;xlinkType&lt;/code&gt;, &lt;code&gt;xmlBase&lt;/code&gt;, &lt;code&gt;xmlLang&lt;/code&gt;, &lt;code&gt;xmlSpace&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;image&lt;/code&gt; SVG tag is now supported by React DOM.&lt;/li&gt;
&lt;li&gt;In React DOM, arbitrary attributes are supported on custom elements (those with a hyphen in the tag name or an &lt;code&gt;is=&amp;quot;...&amp;quot;&lt;/code&gt; attribute).&lt;/li&gt;
&lt;li&gt;React DOM now supports these media events on &lt;code&gt;audio&lt;/code&gt; and &lt;code&gt;video&lt;/code&gt; tags: &lt;code&gt;onAbort&lt;/code&gt;, &lt;code&gt;onCanPlay&lt;/code&gt;, &lt;code&gt;onCanPlayThrough&lt;/code&gt;, &lt;code&gt;onDurationChange&lt;/code&gt;, &lt;code&gt;onEmptied&lt;/code&gt;, &lt;code&gt;onEncrypted&lt;/code&gt;, &lt;code&gt;onEnded&lt;/code&gt;, &lt;code&gt;onError&lt;/code&gt;, &lt;code&gt;onLoadedData&lt;/code&gt;, &lt;code&gt;onLoadedMetadata&lt;/code&gt;, &lt;code&gt;onLoadStart&lt;/code&gt;, &lt;code&gt;onPause&lt;/code&gt;, &lt;code&gt;onPlay&lt;/code&gt;, &lt;code&gt;onPlaying&lt;/code&gt;, &lt;code&gt;onProgress&lt;/code&gt;, &lt;code&gt;onRateChange&lt;/code&gt;, &lt;code&gt;onSeeked&lt;/code&gt;, &lt;code&gt;onSeeking&lt;/code&gt;, &lt;code&gt;onStalled&lt;/code&gt;, &lt;code&gt;onSuspend&lt;/code&gt;, &lt;code&gt;onTimeUpdate&lt;/code&gt;, &lt;code&gt;onVolumeChange&lt;/code&gt;, &lt;code&gt;onWaiting&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Many small performance improvements have been made.&lt;/li&gt;
&lt;li&gt;Many warnings show more context than before.&lt;/li&gt;
&lt;li&gt;Add-Ons: A &lt;a href=&quot;https://github.com/facebook/react/pull/3355&quot;&gt;&lt;code&gt;shallowCompare&lt;/code&gt;&lt;/a&gt; add-on has been added as a migration path for &lt;code&gt;PureRenderMixin&lt;/code&gt; in ES6 classes.&lt;/li&gt;
&lt;li&gt;Add-Ons: &lt;code&gt;CSSTransitionGroup&lt;/code&gt; can now use &lt;a href=&quot;https://github.com/facebook/react/blob/48942b85/docs/docs/10.1-animation.md#custom-classes&quot;&gt;custom class names&lt;/a&gt; instead of appending &lt;code&gt;-enter-active&lt;/code&gt; or similar to the transition name.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;new-helpful-warnings&quot;&gt;&lt;/a&gt;New helpful warnings &lt;a class=&quot;hash-link&quot; href=&quot;#new-helpful-warnings&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;React DOM now warns you when nesting HTML elements invalidly, which helps you avoid surprising errors during updates.&lt;/li&gt;
&lt;li&gt;Passing &lt;code&gt;document.body&lt;/code&gt; directly as the container to &lt;code&gt;ReactDOM.render&lt;/code&gt; now gives a warning as doing so can cause problems with browser extensions that modify the DOM.&lt;/li&gt;
&lt;li&gt;Using multiple instances of React together is not supported, so we now warn when we detect this case to help you avoid running into the resulting problems.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;notable-bug-fixes&quot;&gt;&lt;/a&gt;Notable bug fixes &lt;a class=&quot;hash-link&quot; href=&quot;#notable-bug-fixes&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Click events are handled by React DOM more reliably in mobile browsers, particularly in Mobile Safari.&lt;/li&gt;
&lt;li&gt;SVG elements are created with the correct namespace in more cases.&lt;/li&gt;
&lt;li&gt;React DOM now renders &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; elements with multiple text children properly and renders &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; elements on the server with the correct option selected.&lt;/li&gt;
&lt;li&gt;When two separate copies of React add nodes to the same document (including when a browser extension uses React), React DOM tries harder not to throw exceptions during event handling.&lt;/li&gt;
&lt;li&gt;Using non-lowercase HTML tag names in React DOM (e.g., &lt;code&gt;React.createElement(&amp;#39;DIV&amp;#39;)&lt;/code&gt;) no longer causes problems, though we continue to recommend lowercase for consistency with the JSX tag name convention (lowercase names refer to built-in components, capitalized names refer to custom components).&lt;/li&gt;
&lt;li&gt;React DOM understands that these CSS properties are unitless and does not append “px” to their values: &lt;code&gt;animationIterationCount&lt;/code&gt;, &lt;code&gt;boxOrdinalGroup&lt;/code&gt;, &lt;code&gt;flexOrder&lt;/code&gt;, &lt;code&gt;tabSize&lt;/code&gt;, &lt;code&gt;stopOpacity&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add-Ons: When using the test utils, &lt;code&gt;Simulate.mouseEnter&lt;/code&gt; and &lt;code&gt;Simulate.mouseLeave&lt;/code&gt; now work.&lt;/li&gt;
&lt;li&gt;Add-Ons: ReactTransitionGroup now correctly handles multiple nodes being removed simultaneously.&lt;/li&gt;
&lt;/ul&gt;
</description>
<pubDate>2015-10-07T00:00:00-07:00</pubDate>
<link>https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html</link>
<guid isPermaLink="true">https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html</guid>
</item>
</channel>
</rss>