<?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>React v15.4.0</title>
				<description>&lt;p&gt;Today we are releasing React 15.4.0.&lt;/p&gt;

&lt;p&gt;We didn&amp;#39;t announce the &lt;a href=&quot;https://github.com/facebook/react/blob/master/CHANGELOG.md#1510-may-20-2016&quot;&gt;previous&lt;/a&gt; &lt;a href=&quot;https://github.com/facebook/react/blob/master/CHANGELOG.md#1520-july-1-2016&quot;&gt;minor&lt;/a&gt; &lt;a href=&quot;https://github.com/facebook/react/blob/master/CHANGELOG.md#1530-july-29-2016&quot;&gt;releases&lt;/a&gt; on the blog because most of the changes were bug fixes. However, 15.4.0 is a special release, and we would like to highlight a few notable changes in it.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;separating-react-and-react-dom&quot;&gt;&lt;/a&gt;Separating React and React DOM &lt;a class=&quot;hash-link&quot; href=&quot;#separating-react-and-react-dom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;/react/blog/2015/09/10/react-v0.14-rc1.html#two-packages-react-and-react-dom&quot;&gt;More than a year ago&lt;/a&gt;, we started separating React and React DOM into separate packages. We deprecated &lt;code&gt;React.render()&lt;/code&gt; in favor of &lt;code&gt;ReactDOM.render()&lt;/code&gt; in React 0.14, and removed DOM-specific APIs from &lt;code&gt;React&lt;/code&gt; completely in React 15. However, the React DOM implementation still &lt;a href=&quot;https://www.reddit.com/r/javascript/comments/3m6wyu/found_this_line_in_the_react_codebase_made_me/cvcyo4a/&quot;&gt;secretly lived inside the React package&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In React 15.4.0, we are finally moving React DOM implementation to the React DOM package. The React package will now contain only the renderer-agnostic code such as &lt;code&gt;React.Component&lt;/code&gt; and &lt;code&gt;React.createElement()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This solves a few long-standing issues, such as &lt;a href=&quot;https://github.com/facebook/react/issues/7386&quot;&gt;errors&lt;/a&gt; when you import React DOM in the same file as the &lt;a href=&quot;https://facebook.github.io/jest/blog/2016/07/27/jest-14.html&quot;&gt;snapshot testing&lt;/a&gt; renderer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you only use the official and documented React APIs you won&amp;#39;t need to change anything in your application.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;However, there is a possibility that you imported private APIs from &lt;code&gt;react/lib/*&lt;/code&gt;, or that a package you rely on might use them. We would like to remind you that this was never supported, and that your apps should not rely on internal APIs. The React internals will keep changing as we work to make React better.&lt;/p&gt;

&lt;p&gt;Another thing to watch out for is that React DOM Server is now about the same size as React DOM since it contains its own copy of the React reconciler. We don&amp;#39;t recommend using React DOM Server on the client in most cases.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;profiling-components-with-chrome-timeline&quot;&gt;&lt;/a&gt;Profiling Components with Chrome Timeline &lt;a class=&quot;hash-link&quot; href=&quot;#profiling-components-with-chrome-timeline&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can now visualize React components in the Chrome Timeline. This lets you see which components exactly get mounted, updated, and unmounted, how much time they take relative to each other.&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;img src=&quot;/react/img/blog/react-perf-chrome-timeline.png&quot; width=&quot;651&quot; height=&quot;228&quot; alt=&quot;React components in Chrome timeline&quot; /&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;To use it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Load your app with &lt;code&gt;?react_perf&lt;/code&gt; in the query string (for example, &lt;code&gt;http://localhost:3000/?react_perf&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the Chrome DevTools &lt;strong&gt;Timeline&lt;/strong&gt; tab and press &lt;strong&gt;Record&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perform the actions you want to profile. Don&amp;#39;t record more than 20 seconds or Chrome might hang.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stop recording.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React events will be grouped under the &lt;strong&gt;User Timing&lt;/strong&gt; label.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note that the numbers are relative so components will render faster in production. Still, this should help you realize when unrelated UI gets updated by mistake, and how deep and how often your UI updates occur.&lt;/p&gt;

&lt;p&gt;Currently Chrome, Edge, and IE are the only browsers supporting this feature, but we use the standard &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API&quot;&gt;User Timing API&lt;/a&gt; so we expect more browsers to add support for it.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;mocking-refs-for-snapshot-testing&quot;&gt;&lt;/a&gt;Mocking Refs for Snapshot Testing &lt;a class=&quot;hash-link&quot; href=&quot;#mocking-refs-for-snapshot-testing&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you&amp;#39;re using Jest &lt;a href=&quot;https://facebook.github.io/jest/blog/2016/07/27/jest-14.html&quot;&gt;snapshot testing&lt;/a&gt;, you might have had &lt;a href=&quot;https://github.com/facebook/react/issues/7371&quot;&gt;issues&lt;/a&gt; with components that rely on refs. With React 15.4.0, we introduce a way to provide mock refs to the test renderer. For example, consider this component using a ref in &lt;code&gt;componentDidMount&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;kr&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;from&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;kr&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MyInput&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;hll&quot;&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;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;focus&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;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;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;input&lt;/span&gt;
&lt;span class=&quot;hll&quot;&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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;node&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;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;input&lt;/span&gt; &lt;span class=&quot;o&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;/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;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;With snapshot renderer, &lt;code&gt;this.input&lt;/code&gt; will be &lt;code&gt;null&lt;/code&gt; because there is no DOM. React 15.4.0 lets us avoid such crashes by passing a custom &lt;code&gt;createNodeMock&lt;/code&gt; function to the snapshot renderer in an &lt;code&gt;options&lt;/code&gt; argument:&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;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;React&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;from&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;kr&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;MyInput&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;./MyInput&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kr&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;renderer&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;react-test-renderer&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createNodeMock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;element&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&gt;&lt;span class=&quot;hll&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;nx&quot;&gt;element&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;input&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&gt;&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;      &lt;span class=&quot;nx&quot;&gt;focus&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&gt;&lt;span class=&quot;hll&quot;&gt;    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;it&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;renders correctly&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;o&quot;&gt;=&amp;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;nx&quot;&gt;options&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;createNodeMock&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;  &lt;span class=&quot;kr&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tree&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;renderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;create&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;MyInput&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;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tree&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toMatchSnapshot&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;We would like to thank &lt;a href=&quot;https://github.com/Aweary&quot;&gt;Brandon Dail&lt;/a&gt; for implementing this feature.&lt;/p&gt;

&lt;p&gt;You can learn more about snapshot testing in &lt;a href=&quot;https://facebook.github.io/jest/blog/2016/07/27/jest-14.html&quot;&gt;this Jest blog post&lt;/a&gt;.&lt;/p&gt;

&lt;hr&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 &lt;a href=&quot;https://yarnpkg.com/&quot;&gt;Yarn&lt;/a&gt; or &lt;a href=&quot;https://www.npmjs.com/&quot;&gt;npm&lt;/a&gt; for managing front-end dependencies. If you&amp;#39;re new to package managers, the &lt;a href=&quot;https://yarnpkg.com/en/docs/getting-started&quot;&gt;Yarn documentation&lt;/a&gt; is a good place to get started.&lt;/p&gt;

&lt;p&gt;To install React with Yarn, run:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;yarn add react@15.4.0 react-dom@15.4.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;To install React with npm, run:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;npm install --save react@15.4.0 react-dom@15.4.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We recommend using a bundler like &lt;a href=&quot;https://webpack.github.io/&quot;&gt;webpack&lt;/a&gt; or &lt;a href=&quot;http://browserify.org/&quot;&gt;Browserify&lt;/a&gt; so you can write modular code and bundle it together into small packages to optimize load time.&lt;/p&gt;

&lt;p&gt;Remember that by default, React runs extra checks and provides helpful warnings in development mode. When deploying your app, make sure to &lt;a href=&quot;/react/docs/installation.html#development-and-production-versions&quot;&gt;compile it in production mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In case you don&amp;#39;t use a bundler, we also provide pre-built bundles in the npm packages which you can &lt;a href=&quot;/react/docs/installation.html#using-a-cdn&quot;&gt;include as script tags&lt;/a&gt; on your page:&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://unpkg.com/react@15.4.0/dist/react.js&quot;&gt;react/dist/react.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://unpkg.com/react@15.4.0/dist/react.min.js&quot;&gt;react/dist/react.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://unpkg.com/react@15.4.0/dist/react-with-addons.js&quot;&gt;react/dist/react-with-addons.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://unpkg.com/react@15.4.0/dist/react-with-addons.min.js&quot;&gt;react/dist/react-with-addons.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://unpkg.com/react-dom@15.4.0/dist/react-dom.js&quot;&gt;react-dom/dist/react-dom.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://unpkg.com/react-dom@15.4.0/dist/react-dom.min.js&quot;&gt;react-dom/dist/react-dom.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://unpkg.com/react-dom@15.4.0/dist/react-dom-server.js&quot;&gt;react-dom/dist/react-dom-server.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://unpkg.com/react-dom@15.4.0/dist/react-dom-server.min.js&quot;&gt;react-dom/dist/react-dom-server.min.js&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We&amp;#39;ve also published version &lt;code&gt;15.4.0&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;React package and browser build no longer &amp;quot;secretly&amp;quot; includes React DOM.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/sebmarkbage&quot;&gt;@sebmarkbage&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7164&quot;&gt;#7164&lt;/a&gt; and &lt;a href=&quot;https://github.com/facebook/react/pull/7168&quot;&gt;#7168&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Required PropTypes now fail with specific messages for null and undefined.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/chenglou&quot;&gt;@chenglou&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7291&quot;&gt;#7291&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Improved development performance by freezing children instead of copying.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/keyanzhang&quot;&gt;@keyanzhang&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7455&quot;&gt;#7455&lt;/a&gt;)&lt;/small&gt;&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;Fixed occasional test failures when React DOM is used together with shallow renderer.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/goatslacker&quot;&gt;@goatslacker&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/8097&quot;&gt;#8097&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Added a warning for invalid &lt;code&gt;aria-&lt;/code&gt; attributes.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/jessebeach&quot;&gt;@jessebeach&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7744&quot;&gt;#7744&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Added a warning for using &lt;code&gt;autofocus&lt;/code&gt; rather than &lt;code&gt;autoFocus&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/hkal&quot;&gt;@hkal&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7694&quot;&gt;#7694&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Removed an unnecessary warning about polyfilling &lt;code&gt;String.prototype.split&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/nhunzaker&quot;&gt;@nhunzaker&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7629&quot;&gt;#7629&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Clarified the warning about not calling PropTypes manually.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/jedwards1211&quot;&gt;@jedwards1211&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7777&quot;&gt;#7777&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;The unstable &lt;code&gt;batchedUpdates&lt;/code&gt; API now passes the wrapped function&amp;#39;s return value through.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/bgnorlov&quot;&gt;@bgnorlov&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7444&quot;&gt;#7444&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Fixed a bug with updating text in IE 8.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/mnpenner&quot;&gt;@mnpenner&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7832&quot;&gt;#7832&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-perf&quot;&gt;&lt;/a&gt;React Perf &lt;a class=&quot;hash-link&quot; href=&quot;#react-perf&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When ReactPerf is started, you can now view the relative time spent in components as a chart in Chrome Timeline.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/gaearon&quot;&gt;@gaearon&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7549&quot;&gt;#7549&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-test-utils&quot;&gt;&lt;/a&gt;React Test Utils &lt;a class=&quot;hash-link&quot; href=&quot;#react-test-utils&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If you call &lt;code&gt;Simulate.click()&lt;/code&gt; on a &lt;code&gt;&amp;lt;input disabled onClick={foo} /&amp;gt;&lt;/code&gt; then &lt;code&gt;foo&lt;/code&gt; will get called whereas it didn&amp;#39;t before.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/nhunzaker&quot;&gt;@nhunzaker&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7642&quot;&gt;#7642&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;react-test-renderer&quot;&gt;&lt;/a&gt;React Test Renderer &lt;a class=&quot;hash-link&quot; href=&quot;#react-test-renderer&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Due to packaging changes, it no longer crashes when imported together with React DOM in the same file.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/sebmarkbage&quot;&gt;@sebmarkbage&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7164&quot;&gt;#7164&lt;/a&gt; and &lt;a href=&quot;https://github.com/facebook/react/pull/7168&quot;&gt;#7168&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ReactTestRenderer.create()&lt;/code&gt; now accepts &lt;code&gt;{createNodeMock: element =&amp;gt; mock}&lt;/code&gt; as an optional argument so you can mock refs with snapshot testing.&lt;br&gt;
&lt;small&gt;(&lt;a href=&quot;https://github.com/Aweary&quot;&gt;@Aweary&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/7649&quot;&gt;#7649&lt;/a&gt; and &lt;a href=&quot;https://github.com/facebook/react/pull/8261&quot;&gt;#8261&lt;/a&gt;)&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
				<pubDate>2016-11-16T00:00:00-08:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html</guid>
			</item>
		
			<item>
				<title>Our First 50,000 Stars</title>
				<description>&lt;p&gt;Just three and a half years ago we open sourced a little JavaScript library called React. The journey since that day has been incredibly exciting.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;commemorative-t-shirt&quot;&gt;&lt;/a&gt;Commemorative T-Shirt &lt;a class=&quot;hash-link&quot; href=&quot;#commemorative-t-shirt&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In order to celebrate 50,000 GitHub stars, &lt;a href=&quot;http://www.maggieappleton.com/&quot;&gt;Maggie Appleton&lt;/a&gt; from &lt;a href=&quot;http://egghead.io/&quot;&gt;egghead.io&lt;/a&gt; has designed us a special T-shirt, which will be available for purchase from Teespring &lt;strong&gt;only for a week&lt;/strong&gt; through Thursday, October 6. Maggie also wrote &lt;a href=&quot;https://www.behance.net/gallery/43269677/Reacts-50000-Stars-Shirt&quot;&gt;a blog post&lt;/a&gt; showing all the different concepts she came up with before settling on the final design.&lt;/p&gt;

&lt;p&gt;&lt;a target=&quot;_blank&quot; href=&quot;https://teespring.com/react-50000-stars&quot;&gt;&lt;img src=&quot;/react/img/blog/react-50k-tshirt.jpg&quot; width=&quot;650&quot; height=&quot;340&quot; alt=&quot;React 50k Tshirt&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The T-shirts are super soft using American Apparel&amp;#39;s tri-blend fabric; we also have kids and toddler T-shirts and baby onesies available.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://teespring.com/react-50000-stars&quot;&gt;Adult T-shirts (straight-cut and fitted)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://teespring.com/react-50000-stars-kids&quot;&gt;Kids T-shirts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://teespring.com/react-50000-stars-toddler&quot;&gt;Toddler T-Shirts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://teespring.com/react-50000-stars-baby&quot;&gt;Baby Onesies&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Proceeds from the shirts will be donated to &lt;a href=&quot;http://www.code2040.org/&quot;&gt;CODE2040&lt;/a&gt;, a nonprofit that creates access, awareness, and opportunities in technology for underrepresented minorities with a specific focus on Black and Latinx talent.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;archeology&quot;&gt;&lt;/a&gt;Archeology &lt;a class=&quot;hash-link&quot; href=&quot;#archeology&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We&amp;#39;ve spent a lot of time trying to explain the concepts behind React and the problems it attempts to solve, but we haven&amp;#39;t talked much about how React evolved before being open sourced. This milestone seemed like as good a time as any to dig through the earliest commits and share some of the more important moments and fun facts.&lt;/p&gt;

&lt;p&gt;The story begins in our ads org, where we were building incredibly sophisticated client side web apps using an internal MVC framework called &lt;a href=&quot;http://web.archive.org/web/20130608154901/http://shaneosullivan.github.io/boltjs/intro.html&quot;&gt;BoltJS&lt;/a&gt;. Here&amp;#39;s a sample of what some Bolt code looked like:&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;CarView&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;javelin/core&amp;#39;&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;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;CarView&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;extend&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;container&amp;#39;&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;properties&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;wheels&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&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;declare&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;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;childViews&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;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;I have &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;nx&quot;&gt;ref&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;wheelView&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;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39; wheels&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;span class=&quot;nx&quot;&gt;setWheels&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;nx&quot;&gt;wheels&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;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;findRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;wheelView&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setContent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wheels&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;getWheels&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;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;findRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;wheelView&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getContent&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;car&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;CarView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;car&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setWheels&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;car&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;placeIn&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;body&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//&amp;lt;div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//  &amp;lt;div&amp;gt;I have &amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//  &amp;lt;div&amp;gt;3&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//  &amp;lt;div&amp;gt; wheels&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;//&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Bolt introduced a number of APIs and features that would eventually make their way into React including &lt;code&gt;render&lt;/code&gt;, &lt;code&gt;createClass&lt;/code&gt;, and &lt;code&gt;refs&lt;/code&gt;. Bolt introduced the concept of &lt;code&gt;refs&lt;/code&gt; as a way to create references to nodes that can be used imperatively. This was relevant for legacy interoperability and incremental adoption, and while React would eventually strive to be a lot more functional, &lt;code&gt;refs&lt;/code&gt; proved to be a very useful way to break out of the functional paradigm when the need arose.&lt;/p&gt;

&lt;p&gt;But as our applications grew more and more sophisticated, our Bolt codebases got pretty complicated. Recognizing some of the framework&amp;#39;s shortcomings, &lt;a href=&quot;https://twitter.com/jordwalke&quot;&gt;Jordan Walke&lt;/a&gt; started experimenting with a side-project called &lt;a href=&quot;https://github.com/jordwalke/FaxJs&quot;&gt;FaxJS&lt;/a&gt;. His goal was to solve many of the same problems as Bolt, but in a very different way. This is actually where most of React&amp;#39;s fundamentals were born, including props, state, re-evaluating large portions of the tree to “diff” the UI, server-side rendering, and a basic concept of components.&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;TestProject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;PersonDisplayer&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;structure&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;nx&quot;&gt;Div&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;classSet&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;personDisplayerContainer&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;nx&quot;&gt;titleDiv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Div&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;classSet&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;personNameTitle&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;nx&quot;&gt;content&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;nx&quot;&gt;name&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}),&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;nestedAgeDiv&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Div&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;Interests: &amp;#39;&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;nx&quot;&gt;interests&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;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;fbolt-is-born&quot;&gt;&lt;/a&gt;FBolt is Born &lt;a class=&quot;hash-link&quot; href=&quot;#fbolt-is-born&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Through his FaxJS experiment, Jordan became convinced that functional APIs  — which discouraged mutation —  offered a better, more scalable way to build user interfaces. He imported his library into Facebook&amp;#39;s codebase in March of 2012 and renamed it “FBolt”, signifying an extension of Bolt where components are written in a functional programming style. Or maybe “FBolt” was a nod to FaxJS – he didn&amp;#39;t tell us! ;)&lt;/p&gt;

&lt;p&gt;The interoperability between FBolt and Bolt allowed us to experiment with replacing just one component at a time with more functional component APIs. We could test the waters of this new functional paradigm, without having to go all in. We started with the components that were clearly best expressed functionally and then we would later continue to push the boundaries of what we could express as functions.&lt;/p&gt;

&lt;p&gt;Realizing that FBolt wouldn&amp;#39;t be a great name for the library when used on its own, Jordan Walke and &lt;a href=&quot;https://twitter.com/tomocchino&quot;&gt;Tom Occhino&lt;/a&gt; decided on a new name: “React.” After Tom sent out the diff to rename everything to React, Jordan commented:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Jordan Walke:
I might add for the sake of discussion, that many systems advertise some kind of reactivity, but they usually require that you set up some kind of point-to-point listeners and won&amp;#39;t work on structured data. This API reacts to any state or property changes, and works with data of any form (as deeply structured as the graph itself) so I think the name is fitting.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most of Tom&amp;#39;s other commits at the time were on the first version of &lt;a href=&quot;https://github.com/graphql/graphiql&quot;&gt;GraphiQL&lt;/a&gt;, a project which was recently open sourced.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;adding-jsx&quot;&gt;&lt;/a&gt;Adding JSX &lt;a class=&quot;hash-link&quot; href=&quot;#adding-jsx&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Since about 2010 Facebook has been using an extension of PHP called &lt;a href=&quot;https://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919/&quot;&gt;XHP&lt;/a&gt;, which enables engineers to create UIs using XML literals right inside their PHP code. It was first introduced to help prevent XSS holes but ended up being an excellent way to structure applications with custom components.&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;final&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;post&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;element&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;attribute&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kr&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&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;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;XHPRoot&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$anchor&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;a&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;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getChildren&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;/a&amp;gt;;&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;form&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;post&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;action&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;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;target&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;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;postLink&amp;quot;&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;$anchor&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;/form&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;$this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;transferAllAttributes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$anchor&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;nx&quot;&gt;$form&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;Before Jordan&amp;#39;s work had even made its way into the Facebook codebase, Adam Hupp implemented an XHP-like concept for JavaScript, written in Haskell. This system enabled you to write the following inside a JavaScript file:&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;function&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attrib&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;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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;special&amp;quot;&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;h1&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;p&quot;&gt;,&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;/h1&amp;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;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;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It would compile the above into the following normal ES3-compatible JavaScript:&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jsx_example_hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attrib&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;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;S&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;div&amp;quot;&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;s2&quot;&gt;&amp;quot;class&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;special&amp;quot;&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;S&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;h1&amp;quot;&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;s2&quot;&gt;&amp;quot;Hello, World!&amp;quot;&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;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;In this prototype, &lt;code&gt;S.create&lt;/code&gt; would immediately create and return a DOM node. Most of the conversations on this prototype revolved around the performance characteristics of &lt;code&gt;innerHTML&lt;/code&gt; versus creating DOM nodes directly. At the time, it would have been less than ideal to push developers universally in the direction of creating DOM nodes directly since it did not perform as well, especially in Firefox and IE. Facebook&amp;#39;s then-CTO &lt;a href=&quot;https://twitter.com/btaylor&quot;&gt;Bret Taylor&lt;/a&gt; chimed in on the discussion at the time in favor of &lt;code&gt;innerHTML&lt;/code&gt; over &lt;code&gt;document.createElement&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bret Taylor:
If you are not convinced about innerHTML, here is a small microbenchmark. It is about the same in Chrome. innerHTML is about 30% faster in the latest version of Firefox (much more in previous versions), and about 90% faster in IE8.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This work was eventually abandoned but was revived after React made its way into the codebase. Jordan sidelined the previous performance discussions by introducing the concept of a “Virtual DOM,” though its eventual name didn&amp;#39;t exist yet.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Jordan Walke:
For the first step, I propose that we do the easiest, yet most general transformation possible. My suggestion is to simply map xml expressions to function call expressions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;x&amp;gt;&amp;lt;/x&amp;gt;&lt;/code&gt; becomes &lt;code&gt;x( )&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;x height=12&amp;gt;&amp;lt;/x&amp;gt;&lt;/code&gt; becomes &lt;code&gt;x( {height:12} )&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;x&amp;gt; &amp;lt;y&amp;gt; &amp;lt;/y&amp;gt; &amp;lt;/x&amp;gt;&lt;/code&gt; becomes &lt;code&gt;x({ childList: [y( )] })&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, JSX doesn&amp;#39;t need to know about React - it&amp;#39;s just a convenient way to write function calls. Coincidentally, React&amp;#39;s primary abstraction is the function. Okay maybe it&amp;#39;s not so coincidental ;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Adam made a very insightful comment, which is now the default way we write lists in React with JSX.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Adam Hupp:
I think we should just treat arrays of elements as a frag. This is useful for constructs like:&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ul&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;foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&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;nx&quot;&gt;i&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;li&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;i&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;/li&amp;gt;; })}&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In this case the ul(..) will get a childList with a single child, which is itself a list.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;React didn&amp;#39;t end up using Adam&amp;#39;s implementation directly. Instead, we created JSX by forking &lt;a href=&quot;https://github.com/laverdet/js-xml-literal&quot;&gt;js-xml-literal&lt;/a&gt;, a side project by XHP creator Marcel Laverdet. JSX took its name from js-xml-literal, which Jordan modified to just be syntactic sugar for deeply nested function calls.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;api-churn&quot;&gt;&lt;/a&gt;API Churn &lt;a class=&quot;hash-link&quot; href=&quot;#api-churn&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;During the first year of React, internal adoption was growing quickly but there was quite a lot of churn in the component APIs and naming conventions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;project&lt;/code&gt; was renamed to &lt;code&gt;declare&lt;/code&gt; then to &lt;code&gt;structure&lt;/code&gt; and finally to &lt;code&gt;render&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Componentize&lt;/code&gt; was renamed to &lt;code&gt;createComponent&lt;/code&gt; and finally to &lt;code&gt;createClass&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As the project was about to be open sourced, &lt;a href=&quot;https://twitter.com/leeb&quot;&gt;Lee Byron&lt;/a&gt; sat down with Jordan Walke, Tom Occhino and Sebastian Markbåge in order to refactor, reimplement, and rename one of React&amp;#39;s most beloved features – the lifecycle API. Lee &lt;a href=&quot;https://gist.github.com/vjeux/f2b015d230cc1ab18ed1df30550495ed&quot;&gt;came up with a well-designed API&lt;/a&gt; that is still in place today.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Concepts

&lt;ul&gt;
&lt;li&gt;component - a ReactComponent instance&lt;/li&gt;
&lt;li&gt;state - internal state to a component&lt;/li&gt;
&lt;li&gt;props - external state to a component&lt;/li&gt;
&lt;li&gt;markup - the stringy HTML-ish stuff components generate&lt;/li&gt;
&lt;li&gt;DOM - the document and elements within the document&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Actions

&lt;ul&gt;
&lt;li&gt;mount - to put a component into a DOM&lt;/li&gt;
&lt;li&gt;initialize - to prepare a component for rendering&lt;/li&gt;
&lt;li&gt;update - a transition of state (and props) resulting a render.&lt;/li&gt;
&lt;li&gt;render - a side-effect-free process to get the representation (markup) of a component.&lt;/li&gt;
&lt;li&gt;validate - make assertions about something created and provided&lt;/li&gt;
&lt;li&gt;destroy - opposite of initialize&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Operands

&lt;ul&gt;
&lt;li&gt;create - make a new thing&lt;/li&gt;
&lt;li&gt;get - get an existing thing&lt;/li&gt;
&lt;li&gt;set - merge into existing&lt;/li&gt;
&lt;li&gt;replace - replace existing&lt;/li&gt;
&lt;li&gt;receive - respond to new data&lt;/li&gt;
&lt;li&gt;force - skip checks to do action&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Notifications

&lt;ul&gt;
&lt;li&gt;shouldObjectAction&lt;/li&gt;
&lt;li&gt;objectWillAction&lt;/li&gt;
&lt;li&gt;objectDidAction&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;instagram&quot;&gt;&lt;/a&gt;Instagram &lt;a class=&quot;hash-link&quot; href=&quot;#instagram&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In 2012, Instagram got acquired by Facebook. &lt;a href=&quot;https://twitter.com/floydophone&quot;&gt;Pete Hunt&lt;/a&gt;, who was working on Facebook photos and videos at the time, joined their newly formed web team. He wanted to build their website completely in React, which was in stark contrast with the incremental adoption model that had been used at Facebook.&lt;/p&gt;

&lt;p&gt;To make this happen, React had to be decoupled from Facebook&amp;#39;s infrastructure, since Instagram didn&amp;#39;t use any of it. This project acted as a forcing function to do the work needed to open source React. In the process, Pete also discovered and promoted a little project called Webpack. He also implemented the &lt;code&gt;renderToString&lt;/code&gt; primitive which was needed to do server-side rendering.&lt;/p&gt;

&lt;p&gt;As we started to prepare for the open source launch, &lt;a href=&quot;https://twitter.com/miekd&quot;&gt;Maykel Loomans&lt;/a&gt;, a designer on Instagram, made a mock of what the website could look like. The header ended up defining the visual identity of React: its logo and the electric blue color!&lt;/p&gt;

&lt;p&gt;&lt;center&gt;&lt;a target=&quot;_blank&quot; href=&quot;/react/img/blog/react-50k-mock-full.jpg&quot;&gt;&lt;img src=&quot;/react/img/blog/react-50k-mock.jpg&quot; width=&quot;400&quot; height=&quot;410&quot; alt=&quot;React website mock&quot; /&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;In its earliest days, React benefitted tremendously from feedback, ideas, and technical contributions of early adopters and collaborators all over the company. While it might look like an overnight success in hindsight, the story of React is actually a great example of how new ideas often need to go through several rounds of refinement, iteration, and course correction over a long period of time before reaching their full potential.&lt;/p&gt;

&lt;p&gt;React&amp;#39;s approach to building user interfaces with functional programming principles has changed the way we do things in just a few short years. It goes without saying, but React would be nothing without the amazing open source community that&amp;#39;s built up around it!&lt;/p&gt;
</description>
				<pubDate>2016-09-28T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/09/28/our-first-50000-stars.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/09/28/our-first-50000-stars.html</guid>
			</item>
		
			<item>
				<title>Relay: State of the State</title>
				<description>&lt;p&gt;This month marks a year since we released Relay and we&amp;#39;d like to share an update on the project and what&amp;#39;s next.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;a-year-in-review&quot;&gt;&lt;/a&gt;A Year In Review &lt;a class=&quot;hash-link&quot; href=&quot;#a-year-in-review&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A year after launch, we&amp;#39;re incredibly excited to see an active community forming around Relay and that companies such as Twitter are &lt;a href=&quot;https://fabric.io/blog/building-fabric-mission-control-with-graphql-and-relay&quot;&gt;using Relay in production&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For a project like mission control, GraphQL and Relay were a near-perfect solution, and the cost of building it any other way justified the investment.&lt;/p&gt;

&lt;p&gt;-- &lt;cite&gt;Fin Hopkins&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This kind of positive feedback is really encouraging (I&amp;#39;ll admit to re-reading that post far too many times), and great motivation for us to keep going and make Relay even better.&lt;/p&gt;

&lt;p&gt;With the community&amp;#39;s help we&amp;#39;ve already come a long way since the technical preview. Here are some highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In March we added support for server-side rendering and for creating multiple instances of Relay on a single page. This was a coordinated effort over the course of several months by community members &lt;a href=&quot;https://github.com/denvned&quot;&gt;Denis Nedelyaev&lt;/a&gt; and &lt;a href=&quot;https://github.com/devknoll&quot;&gt;Gerald Monaco&lt;/a&gt; (now at Facebook).&lt;/li&gt;
&lt;li&gt;Also in March we added support for React Native. While we use Relay and React Native together internally, they didn&amp;#39;t quite work together in open-source out of the box. We owe a big thanks to &lt;a href=&quot;https://github.com/skevy&quot;&gt;Adam Miskiewicz&lt;/a&gt;, &lt;a href=&quot;https://github.com/boourns&quot;&gt;Tom Burns&lt;/a&gt;, &lt;a href=&quot;https://github.com/gre&quot;&gt;Gaëtan Renaudeau&lt;/a&gt;, &lt;a href=&quot;https://github.com/davidaurelio&quot;&gt;David Aurelio&lt;/a&gt;, &lt;a href=&quot;https://github.com/martinbigio&quot;&gt;Martín Bigio&lt;/a&gt;, &lt;a href=&quot;https://github.com/zpao&quot;&gt;Paul O’Shannessy&lt;/a&gt;, &lt;a href=&quot;https://github.com/spicyj&quot;&gt;Ben Alpert&lt;/a&gt;, and many others who helped track down and resolve issues. Finally, thanks to &lt;a href=&quot;https://github.com/steveluscher&quot;&gt;Steven Luscher&lt;/a&gt; for coordinating this effort and building the first Relay/ReactNative example app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We&amp;#39;ve also seen some great open-source projects spring up around Relay:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/denvned&quot;&gt;Denis Nedelyaev&lt;/a&gt; created &lt;a href=&quot;https://github.com/denvned/isomorphic-relay/&quot;&gt;isomorphic-relay&lt;/a&gt;, a package that helps developers build server-rendered Relay apps where data is prepared on the server and then used to bootstrap the app on the client.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/taion&quot;&gt;Jimmy Jia&lt;/a&gt; created &lt;a href=&quot;https://github.com/relay-tools/react-router-relay&quot;&gt;react-router-relay&lt;/a&gt; to integrate Relay data-fetching into React Router.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/nodkz&quot;&gt;Pavel Chertorogov&lt;/a&gt; released &lt;a href=&quot;https://github.com/nodkz/react-relay-network-layer&quot;&gt;relay-network-layer&lt;/a&gt;, which adds features such as batching query requests, middleware, authentication, logging, and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is just a small sampling of the community&amp;#39;s contributions. So far we&amp;#39;ve merged over 300 PRs - about 25% of our commits - from over 80 of you. These PRs have improved everything from the website and docs down the very core of the framework. We&amp;#39;re humbled by these outstanding contributions and excited to keep working with each of you!&lt;/p&gt;
&lt;h1&gt;&lt;a class=&quot;anchor&quot; name=&quot;retrospective-amp-roadmap&quot;&gt;&lt;/a&gt;Retrospective &amp;amp; Roadmap &lt;a class=&quot;hash-link&quot; href=&quot;#retrospective-amp-roadmap&quot;&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Earlier this year we paused to reflect on the state of the project. What was working well? What could be improved? What features should we add, and what could we remove? A few themes emerged: performance on mobile, developer experience, and empowering the community.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;mobile-perf&quot;&gt;&lt;/a&gt;Mobile Perf &lt;a class=&quot;hash-link&quot; href=&quot;#mobile-perf&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;First, Relay was built to serve the needs of product developers at Facebook. In 2016, that means helping developers to build apps that work well on &lt;a href=&quot;https://newsroom.fb.com/news/2015/10/news-feed-fyi-building-for-all-connectivity/&quot;&gt;mobile devices connecting on slower networks&lt;/a&gt;. For example, people in developing markets commonly use &lt;a href=&quot;https://code.facebook.com/posts/307478339448736/year-class-a-classification-system-for-android/&quot;&gt;2011 year-class phones&lt;/a&gt; and connect via &lt;a href=&quot;https://code.facebook.com/posts/952628711437136/classes-performance-and-network-segmentation-on-android/&quot;&gt;2G class networks&lt;/a&gt;. These scenarios present their own challenges.&lt;/p&gt;

&lt;p&gt;Therefore, one of our primary goals this year is to optimize Relay for performance on low-end mobile devices &lt;em&gt;first&lt;/em&gt;, knowing that this can translate to improved performance on high-end devices as well. In addition to standard approaches such as benchmarking, profiling, and optimizations, we&amp;#39;re also working on big-picture changes.&lt;/p&gt;

&lt;p&gt;For example, in today&amp;#39;s Relay, here&amp;#39;s what happens when an app is opened. First, React Native starts initializing the JavaScript context (loading and parsing your code and then running it). When this finishes, the app executes and Relay sees that you need data. It constructs and prints the query, uploads the query text to the server, processes the response, and renders your app. (Note that this process applies on the web, except that the code has to be &lt;em&gt;downloaded&lt;/em&gt; instead of loaded from the device.)&lt;/p&gt;

&lt;p&gt;Ideally, though, we could begin fetching data as soon as the native code had loaded - in parallel with the JS context initialization. By the time your JS code was ready to run, the data-fetching would already be under way. To do this we would need a way to determine &lt;em&gt;statically&lt;/em&gt; - at build time - what query an application would send.&lt;/p&gt;

&lt;p&gt;The key is that GraphQL is already static - we just need to fully embrace this fact. More on this later.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;developer-experience&quot;&gt;&lt;/a&gt;Developer Experience &lt;a class=&quot;hash-link&quot; href=&quot;#developer-experience&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Next, we&amp;#39;ve paid attention to the community&amp;#39;s feedback and know that, to put it simply, Relay could be &amp;quot;easier&amp;quot; to use (and &amp;quot;simpler&amp;quot; too). This isn&amp;#39;t entirely surprising to us - Relay was originally designed as a routing library and gradually morphed into a data-fetching library. Concepts like Relay &amp;quot;routes&amp;quot;, for example, no longer serve as critical a role and are just one more concept that developers have to learn about. Another example is mutations: while writes &lt;em&gt;are&lt;/em&gt; inherently more complex than reads, our API doesn&amp;#39;t make the simple things simple enough.&lt;/p&gt;

&lt;p&gt;Alongside our focus on mobile performance, we&amp;#39;ve also kept the developer experience in mind as we evolve Relay core.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;empowering-the-community&quot;&gt;&lt;/a&gt;Empowering the Community &lt;a class=&quot;hash-link&quot; href=&quot;#empowering-the-community&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Finally, we want to make it easier for people in the community to develop useful libraries that work with Relay. By comparison, React&amp;#39;s small surface area - components - allows developers to build cool things like routing, higher-order components, or reusable text editors. For Relay, this would mean having the framework provide core primitives that users can build upon. We want it to be possible for the community to integrate Relay with view libraries other than React, or to build real-time subscriptions as a complementary library.&lt;/p&gt;
&lt;h1&gt;&lt;a class=&quot;anchor&quot; name=&quot;whats-next&quot;&gt;&lt;/a&gt;What&amp;#39;s Next &lt;a class=&quot;hash-link&quot; href=&quot;#whats-next&quot;&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;These were big goals, and also a bit scary; we knew that incremental improvements would only allow us to move so fast. So in April we started a project to build a new implementation of Relay core targeting low-end mobile devices from the start.&lt;/p&gt;

&lt;p&gt;As you can guess since we&amp;#39;re writing this, the experiment was a success. The result is a new core that retains the best parts of Relay today - colocated components &amp;amp; data-dependencies, automatic data/view consistency, declarative data-fetching - while improving performance on mobile devices and addressing several common areas of confusion.&lt;/p&gt;

&lt;p&gt;We&amp;#39;re currently focused on shipping the first applications using the new core: ironing out bugs, refining the API changes and developer experience, and adding any missing features. We&amp;#39;re excited to bring these changes to open source, and will do so once we&amp;#39;ve proven them in production. We&amp;#39;ll go into more detail in some upcoming talks - links below - but for now here&amp;#39;s an overview:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Static Queries&lt;/strong&gt;: By adding a couple of Relay-specific directives, we&amp;#39;ve been able to retain the expressivity of current Relay queries using static syntax (concretely: you know what query an app will execute just by looking at the source text, without having to run that code). For starters this will allow Relay apps to start fetching data in parallel with JavaScript initialization. But it also unlocks other possibilities: knowing the query ahead of time means that we can generate optimized code for handling query responses, for example, or for reading query data from an offline cache.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Expressive Mutations&lt;/strong&gt;: We&amp;#39;ll continue to support a higher-level mutation API for common cases, but will also provide a lower-level API that allows &amp;quot;raw&amp;quot; data access where necessary. If you need to order a list of cached elements, for example, there will be a way to &lt;code&gt;sort()&lt;/code&gt; it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Route-less Relay&lt;/strong&gt;: Routes will be gone in open source. Instead of a route with multiple query definitions, you&amp;#39;ll just provide a single query with as many root fields as you want.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cache Eviction/Garbage Collection&lt;/strong&gt;: The API and architecture is designed from the start to allow removing cached data that is no longer referenced by a mounted view.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stepping back, we recognize that any API changes will require an investment on your part. To make the transition easier, though, &lt;em&gt;we will continue to support the current API for the foreseeable future&lt;/em&gt; (we&amp;#39;re still using it too). And as much as possible we will open-source the tools that we use to migrate our own code. Ideas that we&amp;#39;re exploring include codemods, an interoperability layer for the old/new APIs, and tutorials &amp;amp; guides to ease migration.&lt;/p&gt;

&lt;p&gt;Ultimately, we&amp;#39;re making these changes because we believe they make Relay better all around: simpler for developers building apps and faster for the people using them.&lt;/p&gt;
&lt;h1&gt;&lt;a class=&quot;anchor&quot; name=&quot;conclusion&quot;&gt;&lt;/a&gt;Conclusion &lt;a class=&quot;hash-link&quot; href=&quot;#conclusion&quot;&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;If you made it this far, congrats and thanks for reading! We&amp;#39;ll be sharing more information about these changes in some upcoming talks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/wincent&quot;&gt;Greg Hurrell&lt;/a&gt; will presenting a Relay &amp;quot;Deep Dive&amp;quot; at the &lt;a href=&quot;http://www.meetup.com/Silicon-Valley-ReactJS-Meetup/events/232236845/&quot;&gt;Silicon Valley ReactJS Meetup&lt;/a&gt; on August 17th.&lt;/li&gt;
&lt;li&gt;I (&lt;a href=&quot;https://github.com/josephsavona&quot;&gt;@josephsavona&lt;/a&gt;) will be speaking about Relay at &lt;a href=&quot;http://www.reactrally.com&quot;&gt;React Rally&lt;/a&gt; on August 25th.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can&amp;#39;t wait to share the new code with you and are working as fast as we can to do so!&lt;/p&gt;
</description>
				<pubDate>2016-08-05T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/08/05/relay-state-of-the-state.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/08/05/relay-state-of-the-state.html</guid>
			</item>
		
			<item>
				<title>Create Apps with No Configuration</title>
				<description>&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/facebookincubator/create-react-app&quot;&gt;Create React App&lt;/a&gt;&lt;/strong&gt; is a new officially supported way to create single-page React applications. It offers a modern build setup with no configuration.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;getting-started&quot;&gt;&lt;/a&gt;Getting Started &lt;a class=&quot;hash-link&quot; href=&quot;#getting-started&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;&lt;h3&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;/h3&gt;
&lt;p&gt;First, install the global package:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;npm install -g create-react-app
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Node.js 4.x or higher is required.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;creating-an-app&quot;&gt;&lt;/a&gt;Creating an App &lt;a class=&quot;hash-link&quot; href=&quot;#creating-an-app&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Now you can use it to create a new app:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;create-react-app hello-world
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will take a while as npm installs the transitive dependencies, but once it’s done, you will see a list of commands you can run in the created folder:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/react/img/blog/create-apps-with-no-configuration/created-folder.png&quot; alt=&quot;created folder&quot;&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;starting-the-server&quot;&gt;&lt;/a&gt;Starting the Server &lt;a class=&quot;hash-link&quot; href=&quot;#starting-the-server&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Run &lt;code&gt;npm start&lt;/code&gt; to launch the development server. The browser will open automatically with the created app’s URL.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/react/img/blog/create-apps-with-no-configuration/compiled-successfully.png&quot; alt=&quot;compiled successfully&quot;&gt;&lt;/p&gt;

&lt;p&gt;Create React App uses both Webpack and Babel under the hood.&lt;br&gt;
The console output is tuned to be minimal to help you focus on the problems:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/react/img/blog/create-apps-with-no-configuration/failed-to-compile.png&quot; alt=&quot;failed to compile&quot;&gt;&lt;/p&gt;

&lt;p&gt;ESLint is also integrated so lint warnings are displayed right in the console:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/react/img/blog/create-apps-with-no-configuration/compiled-with-warnings.png&quot; alt=&quot;compiled with warnings&quot;&gt;&lt;/p&gt;

&lt;p&gt;We only picked a small subset of lint rules that often lead to bugs.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;building-for-production&quot;&gt;&lt;/a&gt;Building for Production &lt;a class=&quot;hash-link&quot; href=&quot;#building-for-production&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;To build an optimized bundle, run &lt;code&gt;npm run build&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/react/img/blog/create-apps-with-no-configuration/npm-run-build.png&quot; alt=&quot;npm run build&quot;&gt;&lt;/p&gt;

&lt;p&gt;It is minified, correctly envified, and the assets include content hashes for caching.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;one-dependency&quot;&gt;&lt;/a&gt;One Dependency &lt;a class=&quot;hash-link&quot; href=&quot;#one-dependency&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Your &lt;code&gt;package.json&lt;/code&gt; contains only a single build dependency and a few scripts:&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;s2&quot;&gt;&amp;quot;name&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;hello-world&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;dependencies&amp;quot;&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;s2&quot;&gt;&amp;quot;react&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;^15.2.1&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;react-dom&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;^15.2.1&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;devDependencies&amp;quot;&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;s2&quot;&gt;&amp;quot;react-scripts&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;0.1.0&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
  &lt;span class=&quot;s2&quot;&gt;&amp;quot;scripts&amp;quot;&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;s2&quot;&gt;&amp;quot;start&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;react-scripts start&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;build&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;react-scripts build&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&amp;quot;eject&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;react-scripts eject&amp;quot;&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;We take care of updating Babel, ESLint, and Webpack to stable compatible versions so you can update a single dependency to get them all.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;zero-configuration&quot;&gt;&lt;/a&gt;Zero Configuration &lt;a class=&quot;hash-link&quot; href=&quot;#zero-configuration&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;It is worth repeating: there are no configuration files or complicated folder structures. The tool only generates the files you need to build your app.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;hello-world/
  README.md
  index.html
  favicon.ico
  node_modules/
  package.json
  src/
    App.css
    App.js
    index.css
    index.js
    logo.svg
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;All the build settings are preconfigured and can’t be changed. Some features, such as testing, are currently missing. This is an intentional limitation, and we recognize it might not work for everybody. And this brings us to the last point.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;no-lock-in&quot;&gt;&lt;/a&gt;No Lock-In &lt;a class=&quot;hash-link&quot; href=&quot;#no-lock-in&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;We first saw this feature in &lt;a href=&quot;https://github.com/eanplatter/enclave&quot;&gt;Enclave&lt;/a&gt;, and we loved it. We talked to &lt;a href=&quot;https://twitter.com/EanPlatter&quot;&gt;Ean&lt;/a&gt;, and he was excited to collaborate with us. He already sent a few pull requests!&lt;/p&gt;

&lt;p&gt;“Ejecting” lets you leave the comfort of Create React App setup at any time. You run a single command, and all the build dependencies, configs, and scripts are moved right into your project. At this point you can customize everything you want, but effectively you are forking our configuration and going your own way. If you’re experienced with build tooling and prefer to fine-tune everything to your taste, this lets you use Create React App as a boilerplate generator.&lt;/p&gt;

&lt;p&gt;We expect that at early stages, many people will “eject” for one reason or another, but as we learn from them, we will make the default setup more and more compelling while still providing no configuration.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;try-it-out&quot;&gt;&lt;/a&gt;Try It Out! &lt;a class=&quot;hash-link&quot; href=&quot;#try-it-out&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can find &lt;a href=&quot;https://github.com/facebookincubator/create-react-app&quot;&gt;&lt;strong&gt;Create React App&lt;/strong&gt;&lt;/a&gt; with additional instructions on GitHub.&lt;/p&gt;

&lt;p&gt;This is an experiment, and only time will tell if it becomes a popular way of creating and building React apps, or fades into obscurity.&lt;/p&gt;

&lt;p&gt;We welcome you to participate in this experiment. Help us build the React tooling that more people can use. We are always &lt;a href=&quot;https://github.com/facebookincubator/create-react-app/issues/11&quot;&gt;open to feedback&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;the-backstory&quot;&gt;&lt;/a&gt;The Backstory &lt;a class=&quot;hash-link&quot; href=&quot;#the-backstory&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;React was one of the first libraries to embrace transpiling JavaScript. As a result, even though you can &lt;a href=&quot;https://github.com/facebook/react/blob/3fd582643ef3d222a00a0c756292c15b88f9f83c/examples/basic-jsx/index.html&quot;&gt;learn React without any tooling&lt;/a&gt;, the React ecosystem has commonly become associated with an overwhelming explosion of tools.&lt;/p&gt;

&lt;p&gt;Eric Clemmons called this phenomenon the “&lt;a href=&quot;https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4&quot;&gt;JavaScript Fatigue&lt;/a&gt;”:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ultimately, the problem is that by choosing React (and inherently JSX), you’ve unwittingly opted into a confusing nest of build tools, boilerplate, linters, &amp;amp; time-sinks to deal with before you ever get to create anything.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is tempting to write code in ES2015 and JSX. It is sensible to use a bundler to keep the codebase modular, and a linter to catch the common mistakes. It is nice to have a development server with fast rebuilds, and a command to produce optimized bundles for production.&lt;/p&gt;

&lt;p&gt;Combining these tools requires some experience with each of them. Even so, it is far too easy to get dragged into fighting small incompatibilities, unsatisfied peerDependencies, and illegible configuration files.&lt;/p&gt;

&lt;p&gt;Many of those tools are plugin platforms and don’t directly acknowledge each other’s existence. They leave it up to the users to wire them together. The tools mature and change independently, and tutorials quickly get out of date.&lt;/p&gt;

&lt;blockquote class=&quot;twitter-tweet&quot; data-lang=&quot;en&quot;&gt;&lt;p lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;Marc was almost ready to implement his &amp;quot;hello world&amp;quot; React app &lt;a href=&quot;https://t.co/ptdg4yteF1&quot;&gt;pic.twitter.com/ptdg4yteF1&lt;/a&gt;&lt;/p&gt;&amp;mdash; Thomas Fuchs (@thomasfuchs) &lt;a href=&quot;https://twitter.com/thomasfuchs/status/708675139253174273&quot;&gt;March 12, 2016&lt;/a&gt;&lt;/blockquote&gt;

&lt;script async src=&quot;//platform.twitter.com/widgets.js&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;

&lt;p&gt;This doesn’t mean those tools aren’t great. To many of us, they have become indispensable, and we very much appreciate the effort of their maintainers. They already have too much on their plates to worry about the state of the React ecosystem.&lt;/p&gt;

&lt;p&gt;Still, we knew it was frustrating to spend days setting up a project when all you wanted was to learn React. We wanted to fix this.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;could-we-fix-this&quot;&gt;&lt;/a&gt;Could We Fix This? &lt;a class=&quot;hash-link&quot; href=&quot;#could-we-fix-this&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;We found ourselves in an unusual dilemma.&lt;/p&gt;

&lt;p&gt;So far, &lt;a href=&quot;/react/contributing/design-principles.html#dogfooding&quot;&gt;our strategy&lt;/a&gt; has been to only release the code that we are using at Facebook. This helped us ensure that every project is battle-tested and has clearly defined scope and priorities.&lt;/p&gt;

&lt;p&gt;However, tooling at Facebook is different than at many smaller companies. Linting, transpilation, and packaging are all handled by powerful remote development servers, and product engineers don’t need to configure them. While we wish we could give a dedicated server to every user of React, even Facebook cannot scale that well!&lt;/p&gt;

&lt;p&gt;The React community is very important to us. We knew that we couldn’t fix the problem within the limits of our open source philosophy. This is why we decided to make an exception, and to ship something that we didn’t use ourselves, but that we thought would be useful to the community.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;the-quest-for-a-react-cli&quot;&gt;&lt;/a&gt;The Quest for a React &lt;abbr title=&quot;Command Line Interface&quot;&gt;CLI&lt;/abbr&gt; &lt;a class=&quot;hash-link&quot; href=&quot;#the-quest-for-a-react-cli&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Having just attended &lt;a href=&quot;http://embercamp.com/&quot;&gt;EmberCamp&lt;/a&gt; a week ago, I was excited about &lt;a href=&quot;https://ember-cli.com/&quot;&gt;Ember CLI&lt;/a&gt;. Ember users have a great “getting started” experience thanks to a curated set of tools united under a single command-line interface. I have heard similar feedback about &lt;a href=&quot;https://github.com/elm-lang/elm-reactor&quot;&gt;Elm Reactor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Providing a cohesive curated experience is valuable by itself, even if the user could in theory assemble those parts themselves. Kathy Sierra &lt;a href=&quot;http://seriouspony.com/blog/2013/7/24/your-app-makes-me-fat&quot;&gt;explains it best&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your UX asks the user to make &lt;em&gt;choices&lt;/em&gt;, for example, even if those choices are both clear and useful, the act of &lt;em&gt;deciding&lt;/em&gt; is a cognitive drain. And not just &lt;em&gt;while&lt;/em&gt; they’re deciding... even &lt;em&gt;after&lt;/em&gt; we choose, an unconscious cognitive background thread is slowly consuming/leaking resources, “Was &lt;em&gt;that&lt;/em&gt; the right choice?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I never tried to write a command-line tool for React apps, and neither has &lt;a href=&quot;https://twitter.com/vjeux&quot;&gt;Christopher&lt;/a&gt;. We were chatting on Messenger about this idea, and we decided to work together on it for a week as a hackathon project.&lt;/p&gt;

&lt;p&gt;We knew that such projects traditionally haven’t been very successful in the React ecosystem. Christopher told me that multiple “React CLI” projects have started and failed at Facebook. The community tools with similar goals also exist, but so far they have not yet gained enough traction.&lt;/p&gt;

&lt;p&gt;Still, we decided it was worth another shot. Christopher and I created a very rough proof of concept on the weekend, and &lt;a href=&quot;https://twitter.com/lacker&quot;&gt;Kevin&lt;/a&gt; soon joined us.&lt;/p&gt;

&lt;p&gt;We invited some of the community members to collaborate with us, and we have spent this week working on this tool. We hope that you’ll enjoy using it! &lt;a href=&quot;https://github.com/facebookincubator/create-react-app/issues/11&quot;&gt;Let us know what you think.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We would like to express our gratitude to &lt;a href=&quot;https://twitter.com/mxstbr&quot;&gt;Max Stoiber&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/jbscript&quot;&gt;Jonny Buchanan&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/eanplatter&quot;&gt;Ean Platter&lt;/a&gt;, &lt;a href=&quot;https://github.com/tylermcginnis&quot;&gt;Tyler McGinnis&lt;/a&gt;, &lt;a href=&quot;https://github.com/kentcdodds&quot;&gt;Kent C. Dodds&lt;/a&gt;, and &lt;a href=&quot;https://twitter.com/ericclemmons&quot;&gt;Eric Clemmons&lt;/a&gt; for their early feedback, ideas, and contributions.&lt;/p&gt;
</description>
				<pubDate>2016-07-22T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html</guid>
			</item>
		
			<item>
				<title>Mixins Considered Harmful</title>
				<description>&lt;p&gt;“How do I share the code between several components?” is one of the first questions that people ask when they learn React. Our answer has always been to use component composition for code reuse. You can define a component and use it in several other components.&lt;/p&gt;

&lt;p&gt;It is not always obvious how a certain pattern can be solved with composition. React is influenced by functional programming but it came into the field that was dominated by object-oriented libraries. It was hard for engineers both inside and outside of Facebook to give up on the patterns they were used to.&lt;/p&gt;

&lt;p&gt;To ease the initial adoption and learning, we included certain escape hatches into React. The mixin system was one of those escape hatches, and its goal was to give you a way to reuse code between components when you aren’t sure how to solve the same problem with composition.&lt;/p&gt;

&lt;p&gt;Three years passed since React was released. The landscape has changed. Multiple view libraries now adopt a component model similar to React. Using composition over inheritance to build declarative user interfaces is no longer a novelty. We are also more confident in the React component model, and we have seen many creative uses of it both internally and in the community.&lt;/p&gt;

&lt;p&gt;In this post, we will consider the problems commonly caused by mixins. Then we will suggest several alternative patterns for the same use cases. We have found those patterns to scale better with the complexity of the codebase than mixins.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;why-mixins-are-broken&quot;&gt;&lt;/a&gt;Why Mixins are Broken &lt;a class=&quot;hash-link&quot; href=&quot;#why-mixins-are-broken&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;At Facebook, React usage has grown from a few components to thousands of them. This gives us a window into how people use React. Thanks to declarative rendering and top-down data flow, many teams were able to fix a bunch of bugs while shipping new features as they adopted React.&lt;/p&gt;

&lt;p&gt;However it’s inevitable that some of our code using React gradually became incomprehensible. Occasionally, the React team would see groups of components in different projects that people were afraid to touch. These components were too easy to break accidentally, were confusing to new developers, and eventually became just as confusing to the people who wrote them in the first place. Much of this confusion was caused by mixins. At the time, I wasn’t working at Facebook but I came to the &lt;a href=&quot;https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750&quot;&gt;same conclusions&lt;/a&gt; after writing my fair share of terrible mixins.&lt;/p&gt;

&lt;p&gt;This doesn’t mean that mixins themselves are bad. People successfully employ them in different languages and paradigms, including some functional languages. At Facebook, we extensively use traits in Hack which are fairly similar to mixins. Nevertheless, we think that mixins are unnecessary and problematic in React codebases. Here’s why.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;mixins-introduce-implicit-dependencies&quot;&gt;&lt;/a&gt;Mixins introduce implicit dependencies &lt;a class=&quot;hash-link&quot; href=&quot;#mixins-introduce-implicit-dependencies&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes a component relies on a certain method defined in the mixin, such as &lt;code&gt;getClassName()&lt;/code&gt;. Sometimes it’s the other way around, and mixin calls a method like &lt;code&gt;renderHeader()&lt;/code&gt; on the component. JavaScript is a dynamic language so it’s hard to enforce or document these dependencies.&lt;/p&gt;

&lt;p&gt;Mixins break the common and usually safe assumption that you can rename a state key or a method by searching for its occurrences in the component file. You might write a stateful component and then your coworker might add a mixin that reads this state. In a few months, you might want to move that state up to the parent component so it can be shared with a sibling. Will you remember to update the mixin to read a prop instead? What if, by now, other components also use this mixin?&lt;/p&gt;

&lt;p&gt;These implicit dependencies make it hard for new team members to contribute to a codebase. A component’s &lt;code&gt;render()&lt;/code&gt; method might reference some method that isn’t defined on the class. Is it safe to remove? Perhaps it’s defined in one of the mixins. But which one of them? You need to scroll up to the mixin list, open each of those files, and look for this method. Worse, mixins can specify their own mixins, so the search can be deep.&lt;/p&gt;

&lt;p&gt;Often, mixins come to depend on other mixins, and removing one of them breaks the other. In these situations it is very tricky to tell how the data flows in and out of mixins, and what their dependency graph looks like. Unlike components, mixins don’t form a hierarchy: they are flattened and operate in the same namespace.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;mixins-cause-name-clashes&quot;&gt;&lt;/a&gt;Mixins cause name clashes &lt;a class=&quot;hash-link&quot; href=&quot;#mixins-cause-name-clashes&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There is no guarantee that two particular mixins can be used together. For example, if &lt;code&gt;FluxListenerMixin&lt;/code&gt; defines &lt;code&gt;handleChange()&lt;/code&gt; and &lt;code&gt;WindowSizeMixin&lt;/code&gt; defines &lt;code&gt;handleChange()&lt;/code&gt;, you can’t use them together. You also can’t define a method with this name on your own component.&lt;/p&gt;

&lt;p&gt;It’s not a big deal if you control the mixin code. When you have a conflict, you can rename that method on one of the mixins. However it’s tricky because some components or other mixins may already be calling this method directly, and you need to find and fix those calls as well.&lt;/p&gt;

&lt;p&gt;If you have a name conflict with a mixin from a third party package, you can’t just rename a method on it. Instead, you have to use awkward method names on your component to avoid clashes.&lt;/p&gt;

&lt;p&gt;The situation is no better for mixin authors. Even adding a new method to a mixin is always a potentially breaking change because a method with the same name might already exist on some of the components using it, either directly or through another mixin. Once written, mixins are hard to remove or change. Bad ideas don’t get refactored away because refactoring is too risky.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;mixins-cause-snowballing-complexity&quot;&gt;&lt;/a&gt;Mixins cause snowballing complexity &lt;a class=&quot;hash-link&quot; href=&quot;#mixins-cause-snowballing-complexity&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Even when mixins start out simple, they tend to become complex over time. The example below is based on a real scenario I’ve seen play out in a codebase.&lt;/p&gt;

&lt;p&gt;A component needs some state to track mouse hover. To keep this logic reusable, you might extract &lt;code&gt;handleMouseEnter()&lt;/code&gt;, &lt;code&gt;handleMouseLeave()&lt;/code&gt; and &lt;code&gt;isHovering()&lt;/code&gt; into a &lt;code&gt;HoverMixin&lt;/code&gt;. Next, somebody needs to implement a tooltip. They don’t want to duplicate the logic in &lt;code&gt;HoverMixin&lt;/code&gt; so they create a &lt;code&gt;TooltipMixin&lt;/code&gt; that uses &lt;code&gt;HoverMixin&lt;/code&gt;. &lt;code&gt;TooltipMixin&lt;/code&gt; reads &lt;code&gt;isHovering()&lt;/code&gt; provided by &lt;code&gt;HoverMixin&lt;/code&gt; in its &lt;code&gt;componentDidUpdate()&lt;/code&gt; and either shows or hides the tooltip.&lt;/p&gt;

&lt;p&gt;A few months later, somebody wants to make the tooltip direction configurable. In an effort to avoid code duplication, they add support for a new optional method called &lt;code&gt;getTooltipOptions()&lt;/code&gt; to &lt;code&gt;TooltipMixin&lt;/code&gt;. By this time, components that show popovers also use &lt;code&gt;HoverMixin&lt;/code&gt;. However popovers need a different hover delay. To solve this, somebody adds support for an optional &lt;code&gt;getHoverOptions()&lt;/code&gt; method and implements it in &lt;code&gt;TooltipMixin&lt;/code&gt;. Those mixins are now tightly coupled.&lt;/p&gt;

&lt;p&gt;This is fine while there are no new requirements. However this solution doesn’t scale well. What if you want to support displaying multiple tooltips in a single component? You can’t define the same mixin twice in a component. What if the tooltips need to be displayed automatically in a guided tour instead of on hover? Good luck decoupling &lt;code&gt;TooltipMixin&lt;/code&gt; from &lt;code&gt;HoverMixin&lt;/code&gt;. What if you need to support the case where the hover area and the tooltip anchor are located in different components? You can’t easily hoist the state used by mixin up into the parent component. Unlike components, mixins don’t lend themselves naturally to such changes.&lt;/p&gt;

&lt;p&gt;Every new requirement makes the mixins harder to understand. Components using the same mixin become increasingly coupled with time. Any new capability gets added to all of the components using that mixin. There is no way to split a “simpler” part of the mixin without either duplicating the code or introducing more dependencies and indirection between mixins. Gradually, the encapsulation boundaries erode, and since it’s hard to change or remove the existing mixins, they keep getting more abstract until nobody understands how they work.&lt;/p&gt;

&lt;p&gt;These are the same problems we faced building apps before React. We found that they are solved by declarative rendering, top-down data flow, and encapsulated components. At Facebook, we have been migrating our code to use alternative patterns to mixins, and we are generally happy with the results. You can read about those patterns below.&lt;/p&gt;
&lt;h2&gt;&lt;a class=&quot;anchor&quot; name=&quot;migrating-from-mixins&quot;&gt;&lt;/a&gt;Migrating from Mixins &lt;a class=&quot;hash-link&quot; href=&quot;#migrating-from-mixins&quot;&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Let’s make it clear that mixins are not technically deprecated. If you use &lt;code&gt;React.createClass()&lt;/code&gt;, you may keep using them. We only say that they didn’t work well for us, and so we won’t recommend using them in the future.&lt;/p&gt;

&lt;p&gt;Every section below corresponds to a mixin usage pattern that we found in the Facebook codebase. For each of them, we describe the problem and a solution that we think works better than mixins. The examples are written in ES5 but once you don’t need mixins, you can switch to ES6 classes if you’d like.&lt;/p&gt;

&lt;p&gt;We hope that you find this list helpful. Please let us know if we missed important use cases so we can either amend the list or be proven wrong!&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;performance-optimizations&quot;&gt;&lt;/a&gt;Performance Optimizations &lt;a class=&quot;hash-link&quot; href=&quot;#performance-optimizations&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;One of the most commonly used mixins is &lt;a href=&quot;/react/docs/pure-render-mixin.html&quot;&gt;&lt;code&gt;PureRenderMixin&lt;/code&gt;&lt;/a&gt;. You might be using it in some components to &lt;a href=&quot;/react/docs/advanced-performance.html#shouldcomponentupdate-in-action&quot;&gt;prevent unnecessary re-renders&lt;/a&gt; when the props and state are shallowly equal to the previous props and state:&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;PureRenderMixin&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-addons-pure-render-mixin&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;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;mixins&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;PureRenderMixin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;

  &lt;span class=&quot;c1&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;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;solution&quot;&gt;&lt;/a&gt;Solution &lt;a class=&quot;hash-link&quot; href=&quot;#solution&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;To express the same without mixins, you can use the &lt;a href=&quot;/react/docs/shallow-compare.html&quot;&gt;&lt;code&gt;shallowCompare&lt;/code&gt;&lt;/a&gt; function directly instead:&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;shallowCompare&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-addons-shallow-compare&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;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;shouldComponentUpdate&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;nx&quot;&gt;nextProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nextState&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;nx&quot;&gt;shallowCompare&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;nextProps&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;nextState&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;// ...&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 a custom mixin implementing a &lt;code&gt;shouldComponentUpdate&lt;/code&gt; function with different algorithm, we suggest exporting just that single function from a module and calling it directly from your components.&lt;/p&gt;

&lt;p&gt;We understand that more typing can be annoying. For the most common case, we plan to &lt;a href=&quot;https://github.com/facebook/react/pull/7195&quot;&gt;introduce a new base class&lt;/a&gt; called &lt;code&gt;React.PureComponent&lt;/code&gt; in the next minor release. It uses the same shallow comparison as &lt;code&gt;PureRenderMixin&lt;/code&gt; does today.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;subscriptions-and-side-effects&quot;&gt;&lt;/a&gt;Subscriptions and Side Effects &lt;a class=&quot;hash-link&quot; href=&quot;#subscriptions-and-side-effects&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The second most common type of mixins that we encountered are mixins that subscribe a React component to a third-party data source. Whether this data source is a Flux Store, an Rx Observable, or something else, the pattern is very similar: the subscription is created in &lt;code&gt;componentDidMount&lt;/code&gt;, destroyed in &lt;code&gt;componentWillUnmount&lt;/code&gt;, and the change handler calls &lt;code&gt;this.setState()&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;SubscriptionMixin&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;getInitialState&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;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;componentDidMount&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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addChangeListener&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;handleChange&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;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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;removeChangeListener&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;handleChange&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;handleChange&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;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;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentList&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;mixins&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;SubscriptionMixin&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;c1&quot;&gt;// Reading comments from state managed by mixin.&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comments&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;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&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;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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&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;nx&quot;&gt;comment&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;Comment&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comment&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&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;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;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;solution&quot;&gt;&lt;/a&gt;Solution &lt;a class=&quot;hash-link&quot; href=&quot;#solution&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If there is just one component subscribed to this data source, it is fine to embed the subscription logic right into the component. Avoid premature abstractions.&lt;/p&gt;

&lt;p&gt;If several components used this mixin to subscribe to a data source, a nice way to avoid repetition is to use a pattern called &lt;a href=&quot;https://medium.com/@dan_abramov/mixins-are-dead-long-live-higher-order-components-94a0d2f9e750&quot;&gt;“higher-order components”&lt;/a&gt;. It can sound intimidating so we will take a closer look at how this pattern naturally emerges from the component model.&lt;/p&gt;
&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;higher-order-components-explained&quot;&gt;&lt;/a&gt;Higher-Order Components Explained &lt;a class=&quot;hash-link&quot; href=&quot;#higher-order-components-explained&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Let’s forget about React for a second. Consider these two functions that add and multiply numbers, logging the results as they do that:&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;addAndLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;result:&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&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;nx&quot;&gt;result&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;multiplyAndLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;result:&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&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;nx&quot;&gt;result&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;These two functions are not very useful but they help us demonstrate a pattern that we can later apply to components.&lt;/p&gt;

&lt;p&gt;Let’s say that we want to extract the logging logic out of these functions without changing their signatures. How can we do this? An elegant solution is to write a &lt;a href=&quot;https://en.wikipedia.org/wiki/Higher-order_function&quot;&gt;higher-order function&lt;/a&gt;, that is, a function that takes a function as an argument and returns a function.&lt;/p&gt;

&lt;p&gt;Again, it sounds more intimidating than it really is:&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withLogging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wrappedFunction&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;// Return a function with the same API...&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&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;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;// ... that calls the original function&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;wrappedFunction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// ... but also logs its result!&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;result:&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&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;nx&quot;&gt;result&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;The &lt;code&gt;withLogging&lt;/code&gt; higher-order function lets us write &lt;code&gt;add&lt;/code&gt; and &lt;code&gt;multiply&lt;/code&gt; without the logging statements, and later wrap them to get &lt;code&gt;addAndLog&lt;/code&gt; and &lt;code&gt;multiplyAndLog&lt;/code&gt; with exactly the same signatures as before:&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;multiply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;nx&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withLogging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;wrappedFunction&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;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;wrappedFunction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;y&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;result:&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&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;nx&quot;&gt;result&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;// Equivalent to writing addAndLog by hand:&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;addAndLog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withLogging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Equivalent to writing multiplyAndLog by hand:&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;multiplyAndLog&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withLogging&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;multiply&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;Higher-order components are a very similar pattern, but applied to components in React. We will apply this transformation from mixins in two steps.&lt;/p&gt;

&lt;p&gt;As a first step, we will split our &lt;code&gt;CommentList&lt;/code&gt; component in two, a child and a parent. The child will be only concerned with rendering the comments. The parent will set up the subscription and pass the up-to-date data to the child via props.&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;// This is a child component.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// It only renders the comments it receives as props.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentList&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;c1&quot;&gt;// Note: now reading from props rather than state.&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comments&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;nx&quot;&gt;comments&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;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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&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;nx&quot;&gt;comment&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;Comment&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comment&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&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;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;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// This is a parent component.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// It subscribes to the data source and renders &amp;lt;CommentList /&amp;gt;.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentListWithSubscription&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;getInitialState&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;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;componentDidMount&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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addChangeListener&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;handleChange&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;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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;removeChangeListener&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;handleChange&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;handleChange&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;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;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;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;c1&quot;&gt;// We pass the current state as props to CommentList.&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;CommentList&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comments&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;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&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;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentListWithSubscription&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;There is just one final step left to do.&lt;/p&gt;

&lt;p&gt;Remember how we made &lt;code&gt;withLogging()&lt;/code&gt; take a function and return another function wrapping it? We can apply a similar pattern to React components.&lt;/p&gt;

&lt;p&gt;We will write a new function called &lt;code&gt;withSubscription(WrappedComponent)&lt;/code&gt;. Its argument could be any React component. We will pass &lt;code&gt;CommentList&lt;/code&gt; as &lt;code&gt;WrappedComponent&lt;/code&gt;, but we could also apply &lt;code&gt;withSubscription()&lt;/code&gt; to any other component in our codebase.&lt;/p&gt;

&lt;p&gt;This function would return another component. The returned component would manage the subscription and render &lt;code&gt;&amp;lt;WrappedComponent /&amp;gt;&lt;/code&gt; with the current data.&lt;/p&gt;

&lt;p&gt;We call this pattern a “higher-order component”.&lt;/p&gt;

&lt;p&gt;The composition happens at React rendering level rather than with a direct function call. This is why it doesn’t matter whether the wrapped component is defined with &lt;code&gt;createClass()&lt;/code&gt;, as an ES6 class or a function. If &lt;code&gt;WrappedComponent&lt;/code&gt; is a React component, the component created by &lt;code&gt;withSubscription()&lt;/code&gt; can render it.&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;// This function takes a component...&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withSubscription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;WrappedComponent&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;// ...and returns another component...&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&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;getInitialState&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;componentDidMount&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;// ... that takes care of the subscription...&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addChangeListener&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;handleChange&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;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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;removeChangeListener&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;handleChange&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;handleChange&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;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;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;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;c1&quot;&gt;// ... and renders the wrapped component with the fresh data!&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;WrappedComponent&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comments&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;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;state&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&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;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;Now we can declare &lt;code&gt;CommentListWithSubscription&lt;/code&gt; by applying &lt;code&gt;withSubscription&lt;/code&gt; to &lt;code&gt;CommentList&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;CommentList&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comments&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;nx&quot;&gt;comments&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;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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&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;nx&quot;&gt;comment&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;Comment&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comment&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&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;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;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// withSubscription() returns a new component that&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// is subscribed to the data source and renders&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// &amp;lt;CommentList /&amp;gt; with up-to-date data.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentListWithSubscription&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withSubscription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CommentList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// The rest of the app is interested in the subscribed component&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// so we export it instead of the original unwrapped CommentList.&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentListWithSubscription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;solution-revisited&quot;&gt;&lt;/a&gt;Solution, Revisited &lt;a class=&quot;hash-link&quot; href=&quot;#solution-revisited&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Now that we understand higher-order components better, let’s take another look at the complete solution that doesn’t involve mixins. There are a few minor changes that are annotated with inline comments:&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withSubscription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;WrappedComponent&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;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;getInitialState&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;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;componentDidMount&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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addChangeListener&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;handleChange&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;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;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;removeChangeListener&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;handleChange&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;handleChange&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;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;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataSource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getComments&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;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;c1&quot;&gt;// Use JSX spread syntax to pass all props and state down automatically.&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;WrappedComponent&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;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;state&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;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;// Optional change: convert CommentList to a functional component&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// because it doesn&amp;#39;t use lifecycle hooks or state.&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;CommentList&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;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt; &lt;span class=&quot;o&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;comments&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;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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;comments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&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;nx&quot;&gt;comment&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;Comment&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;comment&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;key&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;comment&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&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;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;c1&quot;&gt;// Instead of declaring CommentListWithSubscription,&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// we export the wrapped component right away.&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withSubscription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;CommentList&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;Higher-order components are a powerful pattern. You can pass additional arguments to them if you want to further customize their behavior. After all, they are not even a feature of React. They are just functions that receive components and return components that wrap them.&lt;/p&gt;

&lt;p&gt;Like any solution, higher-order components have their own pitfalls. For example, if you heavily use &lt;a href=&quot;/react/docs/more-about-refs.html&quot;&gt;refs&lt;/a&gt;, you might notice that wrapping something into a higher-order component changes the ref to point to the wrapping component. In practice we discourage using refs for component communication so we don’t think it’s a big issue. In the future, we might consider adding &lt;a href=&quot;https://github.com/facebook/react/issues/4213&quot;&gt;ref forwarding&lt;/a&gt; to React to solve this annoyance.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;rendering-logic&quot;&gt;&lt;/a&gt;Rendering Logic &lt;a class=&quot;hash-link&quot; href=&quot;#rendering-logic&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The next most common use case for mixins that we discovered in our codebase is sharing rendering logic between components.&lt;/p&gt;

&lt;p&gt;Here is a typical example of this pattern:&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;RowMixin&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;c1&quot;&gt;// Called by components from render()&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;renderHeader&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;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;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;row-header&amp;#39;&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;h1&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;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getHeaderText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* Defined by components */&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;/h1&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;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;UserRow&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;mixins&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;RowMixin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// Called by RowMixin.renderHeader()&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;getHeaderText&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;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;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fullName&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;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;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;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;renderHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* Defined by RowMixin */&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;h2&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;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;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;biography&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;/h2&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;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;Multiple components may be sharing &lt;code&gt;RowMixin&lt;/code&gt; to render the header, and each of them would need to define &lt;code&gt;getHeaderText()&lt;/code&gt;.&lt;/p&gt;
&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;solution&quot;&gt;&lt;/a&gt;Solution &lt;a class=&quot;hash-link&quot; href=&quot;#solution&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;If you see rendering logic inside a mixin, it’s time to extract a component!&lt;/p&gt;

&lt;p&gt;Instead of &lt;code&gt;RowMixin&lt;/code&gt;, we will define a &lt;code&gt;&amp;lt;Row&amp;gt;&lt;/code&gt; component. We will also replace the convention of defining a &lt;code&gt;getHeaderText()&lt;/code&gt; method with the standard mechanism of top-data flow in React: passing props.&lt;/p&gt;

&lt;p&gt;Finally, since neither of those components currently need lifecycle hooks or state, we can declare them as simple functions:&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;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;RowHeader&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;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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&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;row-header&amp;#39;&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;h1&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;props&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;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;/h1&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;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UserRow&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;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;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;RowHeader&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;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;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fullName&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;h2&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;props&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;biography&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;/h2&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;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Props keep component dependencies explicit, easy to replace, and enforceable with tools like &lt;a href=&quot;https://flowtype.org/&quot;&gt;Flow&lt;/a&gt; and &lt;a href=&quot;https://www.typescriptlang.org/&quot;&gt;TypeScript&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Defining components as functions is not required. There is also nothing wrong with using lifecycle hooks and state—they are first-class React features. We use functional components in this example because they are easier to read and we didn’t need those extra features, but classes would work just as fine.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;context&quot;&gt;&lt;/a&gt;Context &lt;a class=&quot;hash-link&quot; href=&quot;#context&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Another group of mixins we discovered were helpers for providing and consuming &lt;a href=&quot;/react/docs/context.html&quot;&gt;React context&lt;/a&gt;. Context is an experimental unstable feature, has &lt;a href=&quot;https://github.com/facebook/react/issues/2517&quot;&gt;certain issues&lt;/a&gt;, and will likely change its API in the future. We don’t recommend using it unless you’re confident there is no other way of solving your problem.&lt;/p&gt;

&lt;p&gt;Nevertheless, if you already use context today, you might have been hiding its usage with mixins 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;RouterMixin&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;contextTypes&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;router&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;PropTypes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isRequired&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;

  &lt;span class=&quot;c1&quot;&gt;// The mixin provides a method so that components&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// don&amp;#39;t have to use the context API directly.&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;push&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;nx&quot;&gt;path&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;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;path&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Link&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;mixins&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;RouterMixin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;

  &lt;span class=&quot;nx&quot;&gt;handleClick&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;nx&quot;&gt;e&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;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stopPropagation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// This method is defined in RouterMixin.&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;push&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;to&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;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;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;a&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;onClick&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;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;handleClick&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;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;children&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;/a&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;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;solution&quot;&gt;&lt;/a&gt;Solution &lt;a class=&quot;hash-link&quot; href=&quot;#solution&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;We agree that hiding context usage from consuming components is a good idea until the context API stabilizes. However, we recommend using higher-order components instead of mixins for this.&lt;/p&gt;

&lt;p&gt;Let the wrapping component grab something from the context, and pass it down with props to the wrapped 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;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withRouter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;WrappedComponent&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;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;contextTypes&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;router&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;PropTypes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;isRequired&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;c1&quot;&gt;// The wrapper component reads something from the context&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// and passes it down as a prop to the wrapped component.&lt;/span&gt;
      &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;router&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;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;router&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;WrappedComponent&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;router&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;router&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;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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Link&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;handleClick&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;nx&quot;&gt;e&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;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;stopPropagation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// The wrapped component uses props instead of context.&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;router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;push&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;to&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;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;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;a&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;onClick&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;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;handleClick&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;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;children&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;/a&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;p&quot;&gt;});&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Don&amp;#39;t forget to wrap the component!&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;exports&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;withRouter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Link&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’re using a third party library that only provides a mixin, we encourage you to file an issue with them linking to this post so that they can provide a higher-order component instead. In the meantime, you can create a higher-order component around it yourself in exactly the same way.&lt;/p&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;utility-methods&quot;&gt;&lt;/a&gt;Utility Methods &lt;a class=&quot;hash-link&quot; href=&quot;#utility-methods&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes, mixins are used solely to share utility functions between components:&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;ColorMixin&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;getLuminance&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;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;parseInt&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;mi&quot;&gt;16&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;r&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;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0xFF0000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;16&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;g&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;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00FF00&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&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;b&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;c&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000FF&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;mf&quot;&gt;0.299&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.587&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;g&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.114&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;b&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;kd&quot;&gt;var&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;mixins&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;ColorMixin&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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;theme&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;getLuminance&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;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;mi&quot;&gt;160&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;dark&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;light&amp;#39;&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;theme&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;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;children&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;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;solution&quot;&gt;&lt;/a&gt;Solution &lt;a class=&quot;hash-link&quot; href=&quot;#solution&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Put utility functions into regular JavaScript modules and import them. This also makes it easier to test them or use them outside of your components:&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;getLuminance&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;../utils/getLuminance&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;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;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;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;theme&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getLuminance&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;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;mi&quot;&gt;160&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;dark&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;light&amp;#39;&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;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;div&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;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;theme&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;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;children&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;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;other-use-cases&quot;&gt;&lt;/a&gt;Other Use Cases &lt;a class=&quot;hash-link&quot; href=&quot;#other-use-cases&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes people use mixins to selectively add logging to lifecycle hooks in some components. In the future, we intend to provide an &lt;a href=&quot;https://github.com/facebook/react/issues/5306&quot;&gt;official DevTools API&lt;/a&gt; that would let you implement something similar without touching the components. However it’s still very much a work in progress. If you heavily depend on logging mixins for debugging, you might want to keep using those mixins for a little longer.&lt;/p&gt;

&lt;p&gt;If you can’t accomplish something with a component, a higher-order component, or a utility module, it could be mean that React should provide this out of the box. &lt;a href=&quot;https://github.com/facebook/react/issues/new&quot;&gt;File an issue&lt;/a&gt; to tell us about your use case for mixins, and we’ll help you consider alternatives or perhaps implement your feature request.&lt;/p&gt;

&lt;p&gt;Mixins are not deprecated in the traditional sense. You can keep using them with &lt;code&gt;React.createClass()&lt;/code&gt;, as we won’t be changing it further. Eventually, as ES6 classes gain more adoption and their usability problems in React are solved, we might split &lt;code&gt;React.createClass()&lt;/code&gt; into a separate package because most people wouldn’t need it. Even in that case, your old mixins would keep working.&lt;/p&gt;

&lt;p&gt;We believe that the alternatives above are better for the vast majority of cases, and we invite you to try writing React apps without using mixins.&lt;/p&gt;
</description>
				<pubDate>2016-07-13T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/07/13/mixins-considered-harmful.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/07/13/mixins-considered-harmful.html</guid>
			</item>
		
			<item>
				<title>Introducing React&#39;s Error Code System</title>
				<description>&lt;p&gt;Building a better developer experience has been one of the things that React deeply cares about, and a crucial part of it is to detect anti-patterns/potential errors early and provide helpful error messages when things (may) go wrong. However, most of these only exist in development mode; in production, we avoid having extra expensive assertions and sending down full error messages in order to reduce the number of bytes sent over the wire.&lt;/p&gt;

&lt;p&gt;Prior to this release, we stripped out error messages at build-time and this is why you might have seen this message in production:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In order to make debugging in production easier, we&amp;#39;re introducing an Error Code System in &lt;a href=&quot;https://github.com/facebook/react/releases/tag/v15.2.0&quot;&gt;15.2.0&lt;/a&gt;. We developed a &lt;a href=&quot;https://github.com/facebook/react/blob/master/scripts/error-codes/gulp-extract-errors.js&quot;&gt;gulp script&lt;/a&gt; that collects all of our &lt;code&gt;invariant&lt;/code&gt; error messages and folds them to a &lt;a href=&quot;https://github.com/facebook/react/blob/master/scripts/error-codes/codes.json&quot;&gt;JSON file&lt;/a&gt;, and at build-time Babel uses the JSON to &lt;a href=&quot;https://github.com/facebook/react/blob/master/scripts/error-codes/dev-expression-with-codes.js&quot;&gt;rewrite&lt;/a&gt; our &lt;code&gt;invariant&lt;/code&gt; calls in production to reference the corresponding error IDs. Now when things go wrong in production, the error that React throws will contain a URL with an error ID and relevant information. The URL will point you to a page in our documentation where the original error message gets reassembled.&lt;/p&gt;

&lt;p&gt;While we hope you don&amp;#39;t see errors often, you can see how it works &lt;a href=&quot;/react/docs/error-decoder.html?invariant=109&amp;amp;args%5B%5D=Foo&quot;&gt;here&lt;/a&gt;. This is what the same error from above will look like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Minified React error #109; visit https://facebook.github.io/react/docs/error-decoder.html?invariant=109&amp;amp;args[]=Foo for the full message or use the non-minified dev environment for full errors and additional helpful warnings.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We do this so that the developer experience is as good as possible, while also keeping the production bundle size as small as possible. This feature shouldn&amp;#39;t require any changes on your side — use the &lt;code&gt;min.js&lt;/code&gt; files in production or bundle your application code with &lt;code&gt;process.env.NODE_ENV === &amp;#39;production&amp;#39;&lt;/code&gt; and you should be good to go!&lt;/p&gt;
</description>
				<pubDate>2016-07-11T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/07/11/introducing-reacts-error-code-system.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/07/11/introducing-reacts-error-code-system.html</guid>
			</item>
		
			<item>
				<title>React v15.0.1</title>
				<description>&lt;p&gt;Yesterday afternoon we shipped v15.0.0 and quickly got some feedback about a couple of issues. We apologize for these problems and we&amp;#39;ve been working since then to make sure we get fixes into your hands as quickly as possible.&lt;/p&gt;

&lt;p&gt;The first of these issues is related to the removal of an undocumented API. This API was added to enable &lt;a href=&quot;/react/docs/jsx-spread.html&quot;&gt;JSX Spread Attributes&lt;/a&gt; in our JS compile tools (react-tools, JSXTransformer) before &lt;code&gt;Object.assign&lt;/code&gt; was standard. When we stopped supporting these tools last year, we kept the API there to catch the longer tail of people using those tools. Meanwhile we moved to using Babel and encouraged others to do the same. Babel will typically compile the spread use to an &lt;code&gt;_extends&lt;/code&gt; helper, which will use &lt;code&gt;Object.assign&lt;/code&gt;. We did not properly research other compilation tools before deciding to remove the API in v15. Specifically, TypeScript and coffee-react are two popular packages using &lt;code&gt;React.__spread&lt;/code&gt;, as well as reactify which still makes use react-tools. In order to make sure that code compiled with these tools is not broken, we will be restoring the &lt;code&gt;React.__spread&lt;/code&gt; API and adding a warning. It will be removed in the future so if you maintain a project making using of it, we encourage you to compile to &lt;code&gt;Object.assign&lt;/code&gt; directly or a similar helper function.&lt;/p&gt;

&lt;p&gt;The second issue resulted in cursor position being lost in controlled inputs. We merged a pull request earlier this week to fix a separate regression from v0.14. Our goal was to target &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; elements but we ended up targeting all interactions with &lt;code&gt;value&lt;/code&gt; properties. Unfortunately we didn&amp;#39;t test it as thoroughly as we thought. We backed out the offending change and fixed the issue in different way which doesn&amp;#39;t have the same problem.&lt;/p&gt;

&lt;p&gt;We apologize if you installed 15.0.0 and have encountered these issues yourselves.&lt;/p&gt;

&lt;p&gt;As usual, you can get install the &lt;code&gt;react&lt;/code&gt; package via npm or download a browser bundle.&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-15.0.1.js&quot;&gt;https://fb.me/react-15.0.1.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-15.0.1.min.js&quot;&gt;https://fb.me/react-15.0.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-15.0.1.js&quot;&gt;https://fb.me/react-with-addons-15.0.1.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-15.0.1.min.js&quot;&gt;https://fb.me/react-with-addons-15.0.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-15.0.1.js&quot;&gt;https://fb.me/react-dom-15.0.1.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-15.0.1.min.js&quot;&gt;https://fb.me/react-dom-15.0.1.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;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;Restore &lt;code&gt;React.__spread&lt;/code&gt; API to unbreak code compiled with some tools making use of this undocumented API. It is now officially deprecated.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/zpao&quot;&gt;@zpao&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6444&quot;&gt;#6444&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;reactdom&quot;&gt;&lt;/a&gt;ReactDOM &lt;a class=&quot;hash-link&quot; href=&quot;#reactdom&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Fixed issue resulting in loss of cursor position in controlled inputs.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/spicyj&quot;&gt;@spicyj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6449&quot;&gt;#6449&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
				<pubDate>2016-04-08T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/04/08/react-v15.0.1.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/04/08/react-v15.0.1.html</guid>
			</item>
		
			<item>
				<title>React v15.0</title>
				<description>&lt;p&gt;We would like to thank the React community for reporting issues and regressions in the release candidates on our &lt;a href=&quot;https://github.com/facebook/react/issues/&quot;&gt;issue tracker&lt;/a&gt;. Over the last few weeks we fixed those issues, and now, after two release candidates, we are excited to finally release the stable version of React 15.&lt;/p&gt;

&lt;p&gt;As a reminder, &lt;a href=&quot;/react/blog/2016/02/19/new-versioning-scheme.html&quot;&gt;we’re switching to major versions&lt;/a&gt; to indicate that we have been using React in production for a long time. This 15.0 release follows our previous 0.14 version and we’ll continue to follow semver like we’ve been doing since 2013. It’s also worth noting that &lt;a href=&quot;/react/blog/2016/01/12/discontinuing-ie8-support.html&quot;&gt;we no longer actively support Internet Explorer 8&lt;/a&gt;. We believe React will work in its current form there but we will not be prioritizing any efforts to fix new issues that only affect IE8.&lt;/p&gt;

&lt;p&gt;React 15 brings significant improvements to how we interact with the DOM:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We are now using &lt;code&gt;document.createElement&lt;/code&gt; instead of setting &lt;code&gt;innerHTML&lt;/code&gt; when mounting components. This allows us to get rid of the &lt;code&gt;data-reactid&lt;/code&gt; attribute on every node and make the DOM lighter. Using &lt;code&gt;document.createElement&lt;/code&gt; is also faster in modern browsers and fixes a number of edge cases related to SVG elements and running multiple copies of React on the same page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Historically our support for SVG has been incomplete, and many tags and attributes were missing. We heard you, and in React 15 we &lt;a href=&quot;https://github.com/facebook/react/pull/6243&quot;&gt;added support for all the SVG attributes that are recognized by today’s browsers&lt;/a&gt;. If we missed any of the attributes you’d like to use, please &lt;a href=&quot;https://github.com/facebook/react/issues/1657&quot;&gt;let us know&lt;/a&gt;. As a bonus, thanks to using &lt;code&gt;document.createElement&lt;/code&gt;, we no longer need to maintain a list of SVG tags, so any SVG tags that were previously unsupported should work just fine in React 15.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We received some amazing contributions from the community in this release, and we would like to highlight &lt;a href=&quot;https://github.com/facebook/react/pull/5753&quot;&gt;this pull request&lt;/a&gt; by &lt;a href=&quot;https://github.com/mwiencek&quot;&gt;Michael Wiencek&lt;/a&gt; in particular. Thanks to Michael’s work, React 15 no longer emits extra &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; nodes around the text, making the DOM output much cleaner. This was a longstanding annoyance for React users so it’s exciting to accept this as an outside contribution.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While this isn’t directly related to the release, we understand that in order to receive more community contributions like Michael’s, we need to communicate our goals and priorities more openly, and review pull requests more decisively. As a first step towards this, we started publishing &lt;a href=&quot;https://github.com/reactjs/core-notes&quot;&gt;React core team weekly meeting notes&lt;/a&gt; again. We also intend to introduce an RFC process inspired by &lt;a href=&quot;https://github.com/emberjs/rfcs&quot;&gt;Ember RFCs&lt;/a&gt; so external contributors can have more insight and influence in the future development of React. We will keep you updated about this on our blog.&lt;/p&gt;

&lt;p&gt;We are also experimenting with a new changelog format in this post. Every change now links to the corresponding pull request and mentions the author. Let us know whether you find this useful!&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;As usual with major releases, React 15 will remove support for some of the patterns deprecated nine months ago in React 0.14. We know changes can be painful (the Facebook codebase has over 20,000 React components, and that’s not even counting React Native), 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.14, upgrading should be easy. The bulk of changes in this release are actually behind the scenes, impacting the way that React interacts with the DOM. The other substantial change is that React now supports the full range of SVG elements and attributes. Beyond that we have a large number of incremental improvements and additional warnings aimed to aid developers. We’ve also laid some groundwork in the core to bring you some new capabilities in future releases.&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 can’t 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-15.0.0.js&quot;&gt;https://fb.me/react-15.0.0.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-15.0.0.min.js&quot;&gt;https://fb.me/react-15.0.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-15.0.0.js&quot;&gt;https://fb.me/react-with-addons-15.0.0.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-15.0.0.min.js&quot;&gt;https://fb.me/react-with-addons-15.0.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-15.0.0.js&quot;&gt;https://fb.me/react-dom-15.0.0.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-15.0.0.min.js&quot;&gt;https://fb.me/react-dom-15.0.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;document.createelement-is-in-and-data-reactid-is-out&quot;&gt;&lt;/a&gt;&lt;code&gt;document.createElement&lt;/code&gt; is in and &lt;code&gt;data-reactid&lt;/code&gt; is out &lt;a class=&quot;hash-link&quot; href=&quot;#document.createelement-is-in-and-data-reactid-is-out&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;There were a number of large changes to our interactions with the DOM. One of the most noticeable changes is that we no longer set the &lt;code&gt;data-reactid&lt;/code&gt; attribute for each DOM node. While this will make it more difficult to know if a website is using React, the advantage is that the DOM is much more lightweight. This change was made possible by us switching to use &lt;code&gt;document.createElement&lt;/code&gt; on initial render. Previously we would generate a large string of HTML and then set &lt;code&gt;node.innerHTML&lt;/code&gt;. At the time, this was decided to be faster than using &lt;code&gt;document.createElement&lt;/code&gt; for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using &lt;code&gt;createElement&lt;/code&gt; we can make other parts of React faster. The ids were used to map back from events to the original React component, meaning we had to do a bunch of work on every event, even though we cached this data heavily. As we’ve all experienced, caching and in particularly invalidating caches, can be error prone and we saw many hard to reproduce issues over the years as a result. Now we can build up a direct mapping at render time since we already have a handle on the node.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;code&gt;data-reactid&lt;/code&gt; is still present for server-rendered content, however it is much smaller than before and is simply an auto-incrementing counter.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/spicyj&quot;&gt;@spicyj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5205&quot;&gt;#5205&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;no-more-extra-ltspangts&quot;&gt;&lt;/a&gt;No more extra &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s &lt;a class=&quot;hash-link&quot; href=&quot;#no-more-extra-ltspangts&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Another big change with our DOM interaction is how we render text blocks. Previously you may have noticed that React rendered a lot of extra &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s. For example, in our most basic example on the home page we render &lt;code&gt;&amp;lt;div&amp;gt;Hello {this.props.name}&amp;lt;/div&amp;gt;&lt;/code&gt;, resulting in markup that contained 2 &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s. Now we’ll render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. Very few people have depended on the actual markup generated here so it’s likely you are not impacted. However if you were targeting these &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/mwiencek&quot;&gt;@mwiencek&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5753&quot;&gt;#5753&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;rendering-null-now-uses-comment-nodes&quot;&gt;&lt;/a&gt;Rendering &lt;code&gt;null&lt;/code&gt; now uses comment nodes &lt;a class=&quot;hash-link&quot; href=&quot;#rendering-null-now-uses-comment-nodes&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;We’ve also made use of these comment nodes to change what &lt;code&gt;null&lt;/code&gt; renders to. Rendering to &lt;code&gt;null&lt;/code&gt; was a feature we added in React 0.11 and was implemented by rendering &lt;code&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; elements. By rendering to comment nodes now, there’s a chance some of your CSS will be targeting the wrong thing, specifically if you are making use of &lt;code&gt;:nth-child&lt;/code&gt; selectors. React’s use of the &lt;code&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; tag has always been considered an implementation detail of how React targets the DOM. We believe they are safe changes to make without going through a release with warnings detailing the subtle differences as they are details that should not be depended upon. Additionally, we have seen that these changes have improved React performance for many typical applications.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/spicyj&quot;&gt;@spicyj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5451&quot;&gt;#5451&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;functional-components-can-now-return-null-too&quot;&gt;&lt;/a&gt;Functional components can now return &lt;code&gt;null&lt;/code&gt; too &lt;a class=&quot;hash-link&quot; href=&quot;#functional-components-can-now-return-null-too&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;We added support for &lt;a href=&quot;/react/blog/2015/09/10/react-v0.14-rc1.html#stateless-function-components&quot;&gt;defining stateless components as functions&lt;/a&gt; in React 0.14. However, React 0.14 still allowed you to define a class component without extending &lt;code&gt;React.Component&lt;/code&gt; or using &lt;code&gt;React.createClass()&lt;/code&gt;, so &lt;a href=&quot;https://github.com/facebook/react/issues/5355&quot;&gt;we couldn’t reliably tell if your component is a function or a class&lt;/a&gt;, and did not allow returning &lt;code&gt;null&lt;/code&gt; from it. This issue is solved in React 15, and you can now return &lt;code&gt;null&lt;/code&gt; from any component, whether it is a class or a function.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5884&quot;&gt;#5884&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;improved-svg-support&quot;&gt;&lt;/a&gt;Improved SVG support &lt;a class=&quot;hash-link&quot; href=&quot;#improved-svg-support&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;All SVG tags are now fully supported. (Uncommon SVG tags are not present on the &lt;code&gt;React.DOM&lt;/code&gt; element helper, but JSX and &lt;code&gt;React.createElement&lt;/code&gt; work on all tag names.) All SVG attributes that are implemented by the browsers should be supported too. If you find any attributes that we have missed, please &lt;a href=&quot;https://github.com/facebook/react/issues/1657&quot;&gt;let us know in this issue&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/zpao&quot;&gt;@zpao&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6243&quot;&gt;#6243&lt;/a&gt;&lt;/small&gt;&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;ul&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;no-more-extra-ltspangts&quot;&gt;&lt;/a&gt;No more extra &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s &lt;a class=&quot;hash-link&quot; href=&quot;#no-more-extra-ltspangts&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;It’s worth calling out the DOM structure changes above again, in particular the change from &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s. In the course of updating the Facebook codebase, we found a very small amount of code that was depending on the markup that React generated. Some of these cases were integration tests like WebDriver which were doing very specific XPath queries to target nodes. Others were simply tests using &lt;code&gt;ReactDOM.renderToStaticMarkup&lt;/code&gt; and comparing markup. Again, there were a very small number of changes that had to be made, but we don’t want anybody to be blindsided. We encourage everybody to run their test suites when upgrading and consider alternative approaches when possible. One approach that will work for some cases is to explicitly use &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s in your &lt;code&gt;render&lt;/code&gt; method.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/mwiencek&quot;&gt;@mwiencek&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5753&quot;&gt;#5753&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;react.cloneelement-now-resolves-defaultprops&quot;&gt;&lt;/a&gt;&lt;code&gt;React.cloneElement()&lt;/code&gt; now resolves &lt;code&gt;defaultProps&lt;/code&gt; &lt;a class=&quot;hash-link&quot; href=&quot;#react.cloneelement-now-resolves-defaultprops&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;We fixed a bug in &lt;code&gt;React.cloneElement()&lt;/code&gt; that some components may rely on. If some of the &lt;code&gt;props&lt;/code&gt; received by &lt;code&gt;cloneElement()&lt;/code&gt; are &lt;code&gt;undefined&lt;/code&gt;, it used to return an element with &lt;code&gt;undefined&lt;/code&gt; values for those props. In React 15, we’re changing it to be consistent with &lt;code&gt;createElement()&lt;/code&gt;. Now any &lt;code&gt;undefined&lt;/code&gt; props passed to &lt;code&gt;cloneElement()&lt;/code&gt; are resolved to the corresponding component’s &lt;code&gt;defaultProps&lt;/code&gt;. Only one of our 20,000 React components was negatively affected by this so we feel comfortable releasing this change without keeping the old behavior for another release cycle.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/truongduy134&quot;&gt;@truongduy134&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5997&quot;&gt;#5997&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;reactperf.getlastmeasurements-is-opaque&quot;&gt;&lt;/a&gt;&lt;code&gt;ReactPerf.getLastMeasurements()&lt;/code&gt; is opaque &lt;a class=&quot;hash-link&quot; href=&quot;#reactperf.getlastmeasurements-is-opaque&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;This change won’t affect applications but may break some third-party tools. We are &lt;a href=&quot;https://github.com/facebook/react/pull/6046&quot;&gt;revamping &lt;code&gt;ReactPerf&lt;/code&gt; implementation&lt;/a&gt; and plan to release it during the 15.x cycle. The internal performance measurement format is subject to change so, for the time being, we consider the return value of &lt;code&gt;ReactPerf.getLastMeasurements()&lt;/code&gt; an opaque data structure that should not be relied upon.  &lt;/p&gt;

&lt;p&gt;&lt;small&gt;&lt;a href=&quot;https://github.com/gaearon&quot;&gt;@gaearon&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6286&quot;&gt;#6286&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4&gt;&lt;a class=&quot;anchor&quot; name=&quot;removed-deprecations&quot;&gt;&lt;/a&gt;Removed deprecations &lt;a class=&quot;hash-link&quot; href=&quot;#removed-deprecations&quot;&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;These deprecations were introduced nine months ago in v0.14 with a warning and are removed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deprecated APIs are removed from the &lt;code&gt;React&lt;/code&gt; top-level export: &lt;code&gt;findDOMNode&lt;/code&gt;, &lt;code&gt;render&lt;/code&gt;, &lt;code&gt;renderToString&lt;/code&gt;, &lt;code&gt;renderToStaticMarkup&lt;/code&gt;, and &lt;code&gt;unmountComponentAtNode&lt;/code&gt;. As a reminder, they are now available on &lt;code&gt;ReactDOM&lt;/code&gt; and &lt;code&gt;ReactDOMServer&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5832&quot;&gt;#5832&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Deprecated addons are removed: &lt;code&gt;batchedUpdates&lt;/code&gt; and &lt;code&gt;cloneWithProps&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5859&quot;&gt;#5859&lt;/a&gt;, &lt;a href=&quot;https://github.com/zpao&quot;&gt;@zpao&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6016&quot;&gt;#6016&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Deprecated component instance methods are removed: &lt;code&gt;setProps&lt;/code&gt;, &lt;code&gt;replaceProps&lt;/code&gt;, and &lt;code&gt;getDOMNode&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5570&quot;&gt;#5570&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Deprecated CommonJS &lt;code&gt;react/addons&lt;/code&gt; entry point is removed. As a reminder, you should use separate &lt;code&gt;react-addons-*&lt;/code&gt; packages instead. This only applies if you use the CommonJS builds.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/gaearon&quot;&gt;@gaearon&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6285&quot;&gt;#6285&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;Passing &lt;code&gt;children&lt;/code&gt; to void elements like &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; was deprecated, and now throws an error.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jonhester&quot;&gt;@jonhester&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/3372&quot;&gt;#3372&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;li&gt;React-specific properties on DOM &lt;code&gt;refs&lt;/code&gt; (e.g. &lt;code&gt;this.refs.div.props&lt;/code&gt;) were deprecated, and are removed now.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5495&quot;&gt;#5495&lt;/a&gt;&lt;/small&gt;&lt;/li&gt;
&lt;/ul&gt;&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 React 16 so you can upgrade your code gradually.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;LinkedStateMixin&lt;/code&gt; and &lt;code&gt;valueLink&lt;/code&gt; are now deprecated due to very low popularity. If you need this, you can use a wrapper component that implements the same behavior: &lt;a href=&quot;https://www.npmjs.com/package/react-linked-input&quot;&gt;react-linked-input&lt;/a&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6127&quot;&gt;#6127&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Future versions of React will treat &lt;code&gt;&amp;lt;input value={null}&amp;gt;&lt;/code&gt; as a request to clear the input. However, React 0.14 has been ignoring &lt;code&gt;value={null}&lt;/code&gt;. React 15 warns you on a &lt;code&gt;null&lt;/code&gt; input value and offers you to clarify your intention. To fix the warning, you may explicitly pass an empty string to clear a controlled input, or pass &lt;code&gt;undefined&lt;/code&gt; to make the input uncontrolled.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/antoaravinth&quot;&gt;@antoaravinth&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5048&quot;&gt;#5048&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;ReactPerf.printDOM()&lt;/code&gt; was renamed to &lt;code&gt;ReactPerf.printOperations()&lt;/code&gt;, and &lt;code&gt;ReactPerf.getMeasurementsSummaryMap()&lt;/code&gt; was renamed to &lt;code&gt;ReactPerf.getWasted()&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/gaearon&quot;&gt;@gaearon&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6287&quot;&gt;#6287&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&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;&lt;p&gt;If you use a minified copy of the &lt;em&gt;development&lt;/em&gt; build, React DOM kindly encourages you to use the faster production build instead.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/spicyj&quot;&gt;@spicyj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5083&quot;&gt;#5083&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM: When specifying a unit-less CSS value as a string, a future version will not add &lt;code&gt;px&lt;/code&gt; automatically. This version now warns in this case (ex: writing &lt;code&gt;style={{width: &amp;#39;300&amp;#39;}}&lt;/code&gt;. Unitless &lt;em&gt;number&lt;/em&gt; values like &lt;code&gt;width: 300&lt;/code&gt; are unchanged.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/pluma&quot;&gt;@pluma&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5140&quot;&gt;#5140&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Synthetic Events will now warn when setting and accessing properties (which will not get cleared appropriately), as well as warn on access after an event has been returned to the pool.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/kentcdodds&quot;&gt;@kentcdodds&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5940&quot;&gt;#5940&lt;/a&gt; and &lt;a href=&quot;https://github.com/koba04&quot;&gt;@koba04&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5947&quot;&gt;#5947&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Elements will now warn when attempting to read &lt;code&gt;ref&lt;/code&gt; and &lt;code&gt;key&lt;/code&gt; from the props.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/prometheansacrifice&quot;&gt;@prometheansacrifice&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5744&quot;&gt;#5744&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React will now warn if you pass a different &lt;code&gt;props&lt;/code&gt; object to &lt;code&gt;super()&lt;/code&gt; in the constructor.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/prometheansacrifice&quot;&gt;@prometheansacrifice&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5346&quot;&gt;#5346&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React will now warn if you call &lt;code&gt;setState()&lt;/code&gt; inside &lt;code&gt;getChildContext()&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/raineroviir&quot;&gt;@raineroviir&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6121&quot;&gt;#6121&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now attempts to warn for mistyped event handlers on DOM elements, such as &lt;code&gt;onclick&lt;/code&gt; which should be &lt;code&gt;onClick&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/ali&quot;&gt;@ali&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5361&quot;&gt;#5361&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now warns about &lt;code&gt;NaN&lt;/code&gt; values in &lt;code&gt;style&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jontewks&quot;&gt;@jontewks&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5811&quot;&gt;#5811&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now warns if you specify both &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;defaultValue&lt;/code&gt; for an input.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/mgmcdermott&quot;&gt;@mgmcdermott&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5823&quot;&gt;#5823&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now warns if an input switches between being controlled and uncontrolled.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/TheBlasfem&quot;&gt;@TheBlasfem&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5864&quot;&gt;#5864&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now warns if you specify &lt;code&gt;onFocusIn&lt;/code&gt; or &lt;code&gt;onFocusOut&lt;/code&gt; handlers as they are unnecessary in React.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jontewks&quot;&gt;@jontewks&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6296&quot;&gt;#6296&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React now prints a descriptive error message when you pass an invalid callback as the last argument to &lt;code&gt;ReactDOM.render()&lt;/code&gt;, &lt;code&gt;this.setState()&lt;/code&gt;, or &lt;code&gt;this.forceUpdate()&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/conorhastings&quot;&gt;@conorhastings&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5193&quot;&gt;#5193&lt;/a&gt; and &lt;a href=&quot;https://github.com/gaearon&quot;&gt;@gaearon&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6310&quot;&gt;#6310&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add-Ons: &lt;code&gt;TestUtils.Simulate()&lt;/code&gt; now prints a helpful message if you attempt to use it with shallow rendering.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/conorhastings&quot;&gt;@conorhastings&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5358&quot;&gt;#5358&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PropTypes: &lt;code&gt;arrayOf()&lt;/code&gt; and &lt;code&gt;objectOf()&lt;/code&gt; provide better error messages for invalid arguments.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/chicoxyzzy&quot;&gt;@chicoxyzzy&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5390&quot;&gt;#5390&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&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;&lt;p&gt;Fixed multiple small memory leaks.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/spicyj&quot;&gt;@spicyj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/4983&quot;&gt;#4983&lt;/a&gt; and &lt;a href=&quot;https://github.com/victor-homyakov&quot;&gt;@victor-homyakov&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6309&quot;&gt;#6309&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Input events are handled more reliably in IE 10 and IE 11; spurious events no longer fire when using a placeholder.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jquense&quot;&gt;@jquense&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/4051&quot;&gt;#4051&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;componentWillReceiveProps()&lt;/code&gt; lifecycle method is now consistently called when &lt;code&gt;context&lt;/code&gt; changes.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/milesj&quot;&gt;@milesj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5787&quot;&gt;#5787&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;React.cloneElement()&lt;/code&gt; doesn’t append slash to an existing &lt;code&gt;key&lt;/code&gt; when used inside &lt;code&gt;React.Children.map()&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/ianobermiller&quot;&gt;@ianobermiller&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5892&quot;&gt;#5892&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now supports the &lt;code&gt;cite&lt;/code&gt; and &lt;code&gt;profile&lt;/code&gt; HTML attributes.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/AprilArcus&quot;&gt;@AprilArcus&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6094&quot;&gt;#6094&lt;/a&gt; and &lt;a href=&quot;https://github.com/saiichihashimoto&quot;&gt;@saiichihashimoto&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6032&quot;&gt;#6032&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now supports &lt;code&gt;cssFloat&lt;/code&gt;, &lt;code&gt;gridRow&lt;/code&gt; and &lt;code&gt;gridColumn&lt;/code&gt; CSS properties.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/stevenvachon&quot;&gt;@stevenvachon&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6133&quot;&gt;#6133&lt;/a&gt; and  &lt;a href=&quot;https://github.com/mnordick&quot;&gt;@mnordick&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/4779&quot;&gt;#4779&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now correctly handles &lt;code&gt;borderImageOutset&lt;/code&gt;, &lt;code&gt;borderImageWidth&lt;/code&gt;, &lt;code&gt;borderImageSlice&lt;/code&gt;, &lt;code&gt;floodOpacity&lt;/code&gt;, &lt;code&gt;strokeDasharray&lt;/code&gt;, and &lt;code&gt;strokeMiterlimit&lt;/code&gt; as unitless CSS properties.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/rofrischmann&quot;&gt;@rofrischmann&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6210&quot;&gt;#6210&lt;/a&gt; and &lt;a href=&quot;https://github.com/facebook/react/pull/6270&quot;&gt;#6270&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now supports the &lt;code&gt;onAnimationStart&lt;/code&gt;, &lt;code&gt;onAnimationEnd&lt;/code&gt;, &lt;code&gt;onAnimationIteration&lt;/code&gt;, &lt;code&gt;onTransitionEnd&lt;/code&gt;, and &lt;code&gt;onInvalid&lt;/code&gt; events. Support for &lt;code&gt;onLoad&lt;/code&gt; has been added to &lt;code&gt;object&lt;/code&gt; elements.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/tomduncalf&quot;&gt;@tomduncalf&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5187&quot;&gt;#5187&lt;/a&gt;,  &lt;a href=&quot;https://github.com/milesj&quot;&gt;@milesj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6005&quot;&gt;#6005&lt;/a&gt;, and &lt;a href=&quot;https://github.com/ara4n&quot;&gt;@ara4n&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5781&quot;&gt;#5781&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now defaults to using DOM attributes instead of properties, which fixes a few edge case bugs. Additionally the nullification of values (ex: &lt;code&gt;href={null}&lt;/code&gt;) now results in the forceful removal, no longer trying to set to the default value used by browsers in the absence of a value.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/syranide&quot;&gt;@syranide&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/1510&quot;&gt;#1510&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM does not mistakingly coerce &lt;code&gt;children&lt;/code&gt; to strings for Web Components.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/jimfb&quot;&gt;@jimfb&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5093&quot;&gt;#5093&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now correctly normalizes SVG &lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt; events.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/edmellum&quot;&gt;@edmellum&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5720&quot;&gt;#5720&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM does not throw if a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; is unmounted while its &lt;code&gt;onChange&lt;/code&gt; handler is executing.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/sambev&quot;&gt;@sambev&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6028&quot;&gt;#6028&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM does not throw in Windows 8 apps.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/Andrew8xx8&quot;&gt;@Andrew8xx8&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6063&quot;&gt;#6063&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM does not throw when asynchronously unmounting a child with a &lt;code&gt;ref&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/yiminghe&quot;&gt;@yiminghe&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6095&quot;&gt;#6095&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM no longer forces synchronous layout because of scroll position tracking.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/syranide&quot;&gt;@syranide&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/2271&quot;&gt;#2271&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Object.is&lt;/code&gt; is used in a number of places to compare values, which leads to fewer false positives, especially involving &lt;code&gt;NaN&lt;/code&gt;. In particular, this affects the &lt;code&gt;shallowCompare&lt;/code&gt; add-on.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/chicoxyzzy&quot;&gt;@chicoxyzzy&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6132&quot;&gt;#6132&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add-Ons: ReactPerf no longer instruments adding or removing an event listener because they don’t really touch the DOM due to event delegation.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/antoaravinth&quot;&gt;@antoaravinth&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5209&quot;&gt;#5209&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a class=&quot;anchor&quot; name=&quot;other-improvements&quot;&gt;&lt;/a&gt; Other improvements &lt;a class=&quot;hash-link&quot; href=&quot;#other-improvements&quot;&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;React now uses &lt;code&gt;loose-envify&lt;/code&gt; instead of &lt;code&gt;envify&lt;/code&gt; so it installs fewer transitive dependencies.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/qerub&quot;&gt;@qerub&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6303&quot;&gt;#6303&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Shallow renderer now exposes &lt;code&gt;getMountedInstance()&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/glenjamin&quot;&gt;@glenjamin&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/4918&quot;&gt;#4918&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Shallow renderer now returns the rendered output from &lt;code&gt;render()&lt;/code&gt;.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/simonewebdesign&quot;&gt;@simonewebdesign&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5411&quot;&gt;#5411&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React no longer depends on ES5 &lt;em&gt;shams&lt;/em&gt; for &lt;code&gt;Object.create&lt;/code&gt; and &lt;code&gt;Object.freeze&lt;/code&gt; in older environments. It still, however, requires ES5 &lt;em&gt;shims&lt;/em&gt; in those environments.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/dgreensp&quot;&gt;@dgreensp&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/4959&quot;&gt;#4959&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM now allows &lt;code&gt;data-&lt;/code&gt; attributes with names that start with numbers.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/nLight&quot;&gt;@nLight&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5216&quot;&gt;#5216&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React DOM adds a new &lt;code&gt;suppressContentEditableWarning&lt;/code&gt; prop for components like &lt;a href=&quot;https://facebook.github.io/draft-js/&quot;&gt;Draft.js&lt;/a&gt; that intentionally manage &lt;code&gt;contentEditable&lt;/code&gt; children with React.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/mxstbr&quot;&gt;@mxstbr&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/6112&quot;&gt;#6112&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React improves the performance for &lt;code&gt;createClass()&lt;/code&gt; on complex specs.&lt;br&gt;
&lt;small&gt;&lt;a href=&quot;https://github.com/spicyj&quot;&gt;@spicyj&lt;/a&gt; in &lt;a href=&quot;https://github.com/facebook/react/pull/5550&quot;&gt;#5550&lt;/a&gt;&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
				<pubDate>2016-04-07T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/04/07/react-v15.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/04/07/react-v15.html</guid>
			</item>
		
			<item>
				<title>React v0.14.8</title>
				<description>&lt;p&gt;We have already released two release candidates for React 15, and the final version is coming soon.&lt;/p&gt;

&lt;p&gt;However &lt;a href=&quot;https://github.com/iancmyers&quot;&gt;Ian Christian Myers&lt;/a&gt; discovered a memory leak related to server rendering in React 0.14 and &lt;a href=&quot;https://github.com/facebook/react/pull/6060&quot;&gt;contributed a fix&lt;/a&gt;. While this memory leak has already been fixed in a different way in the React 15 release candidates, we decided to cut another 0.14 release that contains just this fix.&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.8.js&quot;&gt;https://fb.me/react-0.14.8.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-0.14.8.min.js&quot;&gt;https://fb.me/react-0.14.8.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.8.js&quot;&gt;https://fb.me/react-with-addons-0.14.8.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-0.14.8.min.js&quot;&gt;https://fb.me/react-with-addons-0.14.8.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.8.js&quot;&gt;https://fb.me/react-dom-0.14.8.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-0.14.8.min.js&quot;&gt;https://fb.me/react-dom-0.14.8.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.8.js&quot;&gt;https://fb.me/react-dom-server-0.14.8.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-server-0.14.8.min.js&quot;&gt;https://fb.me/react-dom-server-0.14.8.min.js&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We&amp;#39;ve also published version &lt;code&gt;0.14.8&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;Fixed memory leak when rendering on the server&lt;/li&gt;
&lt;/ul&gt;
</description>
				<pubDate>2016-03-29T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/03/29/react-v0.14.8.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/03/29/react-v0.14.8.html</guid>
			</item>
		
			<item>
				<title>React v15.0 Release Candidate 2</title>
				<description>&lt;p&gt;Today we&amp;#39;re releasing a second release candidate for version 15. Primarily this is to address 2 issues, but we also picked up a few small changes from new contributors, including some improvements to some of our new warnings.&lt;/p&gt;

&lt;p&gt;The most pressing change that was made is to fix a bug in our new code that removes &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s, as discussed in the original RC1 post. Specifically we have some code that takes a different path in IE11 and Edge due to the speed of some DOM operations. There was a bug in this code which didn&amp;#39;t break out of the optimization for &lt;code&gt;DocumentFragment&lt;/code&gt;s, resulting in text not appearing at all. Thanks to the several people who &lt;a href=&quot;https://github.com/facebook/react/issues/6246&quot;&gt;reported this&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The other change is to our SVG code. In RC1 we had made the decision to pass through all attributes directly. This led to &lt;a href=&quot;https://github.com/facebook/react/issues/6211&quot;&gt;some confusion with &lt;code&gt;class&lt;/code&gt; vs &lt;code&gt;className&lt;/code&gt;&lt;/a&gt; and ultimately led us to reconsider our position on the approach. Passing through all attributes meant that we would have two different patterns for using React where things like hyphenated attributes would work for SVG but not HTML. In the future, we &lt;em&gt;might&lt;/em&gt; change our approach to the problem for HTML as well but in the meantime, maintaining consistency is important. So we reverted the changes that allowed the attributes to be passed through and instead expanded the SVG property list to include all attributes that are in the spec. We believe we have everything now but definitely &lt;a href=&quot;https://github.com/facebook/react/issues/1657#issuecomment-197031403&quot;&gt;let us know&lt;/a&gt; if we missed anything. It was and still is our intent to support the full range of SVG tags and attributes in this release.&lt;/p&gt;

&lt;p&gt;Thanks again to everybody who has tried the RC1 and reported issues. It has been extremely important and we wouldn&amp;#39;t be able to do this without your help!&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@15.0.0-rc.2 react-dom@15.0.0-rc.2&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 can’t 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-15.0.0-rc.2.js&quot;&gt;https://fb.me/react-15.0.0-rc.2.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-15.0.0-rc.2.min.js&quot;&gt;https://fb.me/react-15.0.0-rc.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-15.0.0-rc.2.js&quot;&gt;https://fb.me/react-with-addons-15.0.0-rc.2.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-with-addons-15.0.0-rc.2.min.js&quot;&gt;https://fb.me/react-with-addons-15.0.0-rc.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-15.0.0-rc.2.js&quot;&gt;https://fb.me/react-dom-15.0.0-rc.2.js&lt;/a&gt;&lt;br&gt;
Minified build for production: &lt;a href=&quot;https://fb.me/react-dom-15.0.0-rc.2.min.js&quot;&gt;https://fb.me/react-dom-15.0.0-rc.2.min.js&lt;/a&gt;&lt;br&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
				<pubDate>2016-03-16T00:00:00-07:00</pubDate>
				<link>https://facebook.github.io/react/blog/2016/03/16/react-v15-rc2.html</link>
				<guid isPermaLink="true">https://facebook.github.io/react/blog/2016/03/16/react-v15-rc2.html</guid>
			</item>
		
	</channel>
</rss>
