8000 react/feed.xml at gh-pages · jakedahm/react · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
764 lines (651 loc) · 106 KB

feed.xml

File metadata and controls

764 lines (651 loc) · 106 KB
<span class="p">});</span>
<span class="c1">// 3) As an ES6 class descending from React.Component</span>
<span class="kr">class</span> <span class="nx">Button</span> <span class="kr">extends</span> <span class="nx">React</span><span class="p">.</span><span class="nx">Component</span> <span class="p">{</span>
<span class="nx">render</span><span class="p">()</span> <span class="p">{</span>
<span class="kr">const</span> <span class="p">{</span> <span class="nx">children</span><span class="p">,</span> <span class="nx">color</span> <span class="p">}</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">props</span><span class="p">;</span>
<span class="k">return</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">'button'</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">'button button-'</span> <span class="o">+</span> <span class="nx">color</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">'b'</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="nx">children</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>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.</p>
<p>A functional component is less powerful but is simpler, and acts like a class component with just a single <code>render()</code> method. Unless you need features available only in a class, we encourage you to use functional components instead.</p>
<p><strong>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.</strong></p>
<h3><a class="anchor" name="top-down-reconciliation"></a>Top-Down Reconciliation <a class="hash-link" href="#top-down-reconciliation">#</a></h3>
<p>When you call:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">({</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Form</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">isSubmitted</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="nx">buttonText</span><span class="o">:</span> <span class="s1">'OK!'</span>
<span class="p">}</span>
<span class="p">},</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s1">'root'</span><span class="p">));</span>
</code></pre></div>
<p>React will ask the <code>Form</code> component what element tree it returns, given those <code>props</code>. It will gradually “refine” its understanding of your component tree in terms of simpler primitives:</p>
<div class="highlight"><pre><code class="language-js" data-lang="js"><span class="c1">// React: You told me this...</span>
<span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Form</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">isSubmitted</span><span class="o">:</span> <span class="kc">false</span><span class="p">,</span>
<span class="nx">buttonText</span><span class="o">:</span> <span class="s1">'OK!'</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="c1">// React: ...And Form told me this...</span>
<span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="nx">Button</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">'OK!'</span><span class="p">,</span>
<span class="nx">color</span><span class="o">:</span> <span class="s1">'blue'</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="c1">// React: ...and Button told me this! I guess I'm done.</span>
<span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">'button'</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">className</span><span class="o">:</span> <span class="s1">'button button-blue'</span><span class="p">,</span>
<span class="nx">children</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">type</span><span class="o">:</span> <span class="s1">'b'</span><span class="p">,</span>
<span class="nx">props</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">children</span><span class="o">:</span> <span class="s1">'OK!'</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre></div>
<p>This is a part of the process that React calls <a href="/react/docs/reconciliation.html">reconciliation</a> which starts when you call <a href="/react/docs/top-level-api.html#reactdom.render"><code>ReactDOM.render()</code></a> or <a href="/react/docs/component-api.html#setstate"><code>setState()</code></a>. By the end of the reconciliation, React knows the result DOM tree, and a renderer like <code>react-dom</code> or <code>react-native</code> applies the minimal set of changes necessary to update the DOM nodes (or the platform-specific views in case of React Native).</p>
<p>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 <a href="/react/docs/advanced-performance.html">skip this “refining” and diffing certain parts of the tree if the relevant props have not changed</a>. 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.</p>
<p>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.</p>
<p>Only components declared as classes have instances, and you never create them directly: React does that for you. While <a href="/react/docs/more-about-refs.html">mechanisms for a parent component instance to access a child component instance</a> exist, they are only used for imperative actions (such as setting focus on a field), and should generally be avoided.</p>
<p>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 React’s programming model and are managed by React itself.</p>
<h2><a class="anchor" name="summary"></a>Summary <a class="hash-link" href="#summary">#</a></h2>
<p>An <em>element</em> 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.</p>
<p>A <em>component</em> can be declared in several different ways. It can be a class with a <code>render()</code> 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.</p>
<p>When a component receives some props as an input, it is because a particular parent component returned an element with its <code>type</code> and these props. This is why people say that the props flows one way in React: from parents to children.</p>
<p>An <em>instance</em> is what you refer to as <code>this</code> in the component class you write. It is useful for <a href="/react/docs/component-api.html">storing local state and reacting to the lifecycle events</a>.</p>
<p>Functional components don’t have instances at all. Class components have instances, but you never need to create a component instance directly—React takes care of this.</p>
<p>Finally, to create elements, use <a href="/react/docs/top-level-api.html#react.createelement"><code>React.createElement()</code></a>, <a href="/react/docs/jsx-in-depth.html">JSX</a>, or an <a href="/react/docs/top-level-api.html#react.createfactory">element factory helper</a>. Don’t write elements as plain objects in the real code—just know that they are plain objects under the hood.</p>
<h2><a class="anchor" name="further-reading"></a>Further Reading <a class="hash-link" href="#further-reading">#</a></h2>
<ul>
<li><a href="/react/blog/2014/10/14/introducing-react-elements.html">Introducing React Elements</a></li>
<li><a href="/react/blog/2015/02/24/streamlining-react-elements.html">Streamlining React Elements</a></li>
<li><a href="/react/docs/glossary.html">React (Virtual) DOM Terminology</a></li>
</ul>
<div class="footnotes">
<hr>
<ol>
<li id="fn1">
<p>All React elements require an additional <code>$$typeof: Symbol.for('react.element')</code> field declared on the object for <a href="https://github.com/facebook/react/pull/4832">security reasons</a>. It is omitted in the examples above. This blog entry uses inline objects for elements to give you an idea of what’s happening underneath but the code won’t run as is unless you either add <code>$$typeof</code> to the elements, or change the code to use <code>React.createElement()</code> or JSX. <a href="#fnref1" rev="footnote">↩</a></p>
</li>
</ol>
</div>
</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>
</channel>
</rss>
0