{"componentChunkName":"component---src-templates-blog-js","path":"/blog/2016/11/16/react-v15.4.0.html","result":{"data":{"markdownRemark":{"html":"<p>Today we are releasing React 15.4.0.</p>\n<p>We didn’t announce the <a href=\"https://github.com/facebook/react/blob/master/CHANGELOG.md#1510-may-20-2016\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">previous</a> <a href=\"https://github.com/facebook/react/blob/master/CHANGELOG.md#1520-july-1-2016\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">minor</a> <a href=\"https://github.com/facebook/react/blob/master/CHANGELOG.md#1530-july-29-2016\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">releases</a> 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.</p>\n<h3 id=\"separating-react-and-react-dom\"><a href=\"#separating-react-and-react-dom\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Separating React and React DOM </h3>\n<p><a href=\"/blog/2015/09/10/react-v0.14-rc1.html#two-packages-react-and-react-dom\">More than a year ago</a>, we started separating React and React DOM into separate packages. We deprecated <code class=\"gatsby-code-text\">React.render()</code> in favor of <code class=\"gatsby-code-text\">ReactDOM.render()</code> in React 0.14, and removed DOM-specific APIs from <code class=\"gatsby-code-text\">React</code> completely in React 15. However, the React DOM implementation still <a href=\"https://www.reddit.com/r/javascript/comments/3m6wyu/found_this_line_in_the_react_codebase_made_me/cvcyo4a/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">secretly lived inside the React package</a>.</p>\n<p>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 <code class=\"gatsby-code-text\">React.Component</code> and <code class=\"gatsby-code-text\">React.createElement()</code>.</p>\n<p>This solves a few long-standing issues, such as <a href=\"https://github.com/facebook/react/issues/7386\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">errors</a> when you import React DOM in the same file as the <a href=\"https://facebook.github.io/jest/blog/2016/07/27/jest-14.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">snapshot testing</a> renderer.</p>\n<p><strong>If you only use the official and documented React APIs you won’t need to change anything in your application.</strong></p>\n<p>However, there is a possibility that you imported private APIs from <code class=\"gatsby-code-text\">react/lib/*</code>, 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.</p>\n<p>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’t recommend using React DOM Server on the client in most cases.</p>\n<h3 id=\"profiling-components-with-chrome-timeline\"><a href=\"#profiling-components-with-chrome-timeline\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Profiling Components with Chrome Timeline </h3>\n<p>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.</p>\n\n  <a class=\"gatsby-resp-image-link\" href=\"/static/64d522b74fb585f1abada9801f85fa9d/1ac66/react-perf-chrome-timeline.png\" style=\"display: block\" target=\"_blank\" rel=\"noopener\">\n  \n  <span class=\"gatsby-resp-image-wrapper\" style=\"position: relative; display: block;  max-width: 651px; margin-left: auto; margin-right: auto;\">\n    <span class=\"gatsby-resp-image-background-image\" style=\"padding-bottom: 35.23809523809524%; position: relative; bottom: 0; left: 0; background-image: url(&apos;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAHCAIAAACHqfpvAAAACXBIWXMAAAsSAAALEgHS3X78AAABYUlEQVQY022NeUsCURTF5yMG0aaZSgniMtqCEfQlgoowqCCoRDNIs+gfdVTMJa3JbdRyaROHyXJ0xuc47zVqC0Rw7uHec/lxsPeqmyJ0WT+e8xspwli+wp9ipnZ+QRJHzfP3y3RyPeXAMycm0oEXXeayx/zmXWIDliZhwXgmHzuQxQ+VKefcg0db9+kaQT1D6Gm/vu7V0gEzW7JVLxTF45Gya4wLyoSwvBOaAqFJEBrHel2+Gt1PnGqj9onIkTx3pqLcyrxbVfdrGsFZJowLbKlbcHK32+BmAyTXAGntkFZAboH0LgYhRBCKIAUYX9JmiO0pSLsm7pzJeNSVy2k6toKgAIcSOVFgYY+DQguKvJT34T4tGULP6R3KO0pTm48Rw8v1In23ytWcUg6//mhg6OtACBtuUrfkzdd44VzdqkXZSuijTIB6QuSYbxj+YH/hfiKNwPN0Vuy2ByUQoV/mX/gTU11epAmedTIAAAAASUVORK5CYII=&apos;); background-size: cover; display: block;\">\n      <img class=\"gatsby-resp-image-image\" style=\"width: 100%; height: 100%; margin: 0; vertical-align: middle; position: absolute; top: 0; left: 0; box-shadow: inset 0px 0px 0px 400px white;\" alt=\"React components in Chrome timeline\" title src=\"/static/64d522b74fb585f1abada9801f85fa9d/1ac66/react-perf-chrome-timeline.png\" srcset=\"/static/64d522b74fb585f1abada9801f85fa9d/65ed1/react-perf-chrome-timeline.png 210w,\n/static/64d522b74fb585f1abada9801f85fa9d/d10fb/react-perf-chrome-timeline.png 420w,\n/static/64d522b74fb585f1abada9801f85fa9d/1ac66/react-perf-chrome-timeline.png 651w\" sizes=\"(max-width: 651px) 100vw, 651px\">\n    </span>\n  </span>\n  \n  </a>\n    \n<p>To use it:</p>\n<ol>\n<li>Load your app with <code class=\"gatsby-code-text\">?react_perf</code> in the query string (for example, <code class=\"gatsby-code-text\">http://localhost:3000/?react_perf</code>).</li>\n<li>Open the Chrome DevTools <strong>Timeline</strong> tab and press <strong>Record</strong>.</li>\n<li>Perform the actions you want to profile. Don’t record more than 20 seconds or Chrome might hang.</li>\n<li>Stop recording.</li>\n<li>React events will be grouped under the <strong>User Timing</strong> label.</li>\n</ol>\n<p>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.</p>\n<p>Currently Chrome, Edge, and IE are the only browsers supporting this feature, but we use the standard <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">User Timing API</a> so we expect more browsers to add support for it.</p>\n<h3 id=\"mocking-refs-for-snapshot-testing\"><a href=\"#mocking-refs-for-snapshot-testing\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Mocking Refs for Snapshot Testing </h3>\n<p>If you’re using Jest <a href=\"https://facebook.github.io/jest/blog/2016/07/27/jest-14.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">snapshot testing</a>, you might have had <a href=\"https://github.com/facebook/react/issues/7371\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">issues</a> 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 <code class=\"gatsby-code-text\">componentDidMount</code>:</p>\n<div class=\"gatsby-highlight has-highlighted-lines\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token keyword\">import</span> React <span class=\"token keyword\">from</span> <span class=\"token string\">'react'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"token keyword\">export</span> <span class=\"token keyword\">default</span> <span class=\"token keyword\">class</span> <span class=\"token class-name\">MyInput</span> <span class=\"token keyword\">extends</span> <span class=\"token class-name\">React<span class=\"token punctuation\">.</span>Component</span> <span class=\"token punctuation\">{</span>\n  <span class=\"token function\">componentDidMount</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n<span class=\"gatsby-highlight-code-line\">    <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>input<span class=\"token punctuation\">.</span><span class=\"token function\">focus</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></span>  <span class=\"token punctuation\">}</span>\n\n  <span class=\"token function\">render</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">(</span>\n      <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span>input</span>\n<span class=\"gatsby-highlight-code-line\">        <span class=\"token attr-name\">ref</span><span class=\"token script language-javascript\"><span class=\"token script-punctuation punctuation\">=</span><span class=\"token punctuation\">{</span><span class=\"token parameter\">node</span> <span class=\"token operator\">=></span> <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>input <span class=\"token operator\">=</span> node<span class=\"token punctuation\">}</span></span></span>      <span class=\"token punctuation\">/></span></span>\n    <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>With snapshot renderer, <code class=\"gatsby-code-text\">this.input</code> will be <code class=\"gatsby-code-text\">null</code> because there is no DOM. React 15.4.0 lets us avoid such crashes by passing a custom <code class=\"gatsby-code-text\">createNodeMock</code> function to the snapshot renderer in an <code class=\"gatsby-code-text\">options</code> argument:</p>\n<div class=\"gatsby-highlight has-highlighted-lines\" data-language=\"jsx\"><pre class=\"gatsby-code-jsx\"><code class=\"gatsby-code-jsx\"><span class=\"token keyword\">import</span> React <span class=\"token keyword\">from</span> <span class=\"token string\">'react'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> MyInput <span class=\"token keyword\">from</span> <span class=\"token string\">'./MyInput'</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">import</span> renderer <span class=\"token keyword\">from</span> <span class=\"token string\">'react-test-renderer'</span><span class=\"token punctuation\">;</span>\n\n<span class=\"gatsby-highlight-code-line\"><span class=\"token keyword\">function</span> <span class=\"token function\">createNodeMock</span><span class=\"token punctuation\">(</span><span class=\"token parameter\">element</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></span><span class=\"gatsby-highlight-code-line\">  <span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span>element<span class=\"token punctuation\">.</span>type <span class=\"token operator\">===</span> <span class=\"token string\">'input'</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span></span><span class=\"gatsby-highlight-code-line\">    <span class=\"token keyword\">return</span> <span class=\"token punctuation\">{</span></span><span class=\"gatsby-highlight-code-line\">      <span class=\"token function\">focus</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span></span><span class=\"gatsby-highlight-code-line\">    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span></span><span class=\"gatsby-highlight-code-line\">  <span class=\"token punctuation\">}</span></span><span class=\"gatsby-highlight-code-line\">  <span class=\"token keyword\">return</span> <span class=\"token keyword\">null</span><span class=\"token punctuation\">;</span></span><span class=\"gatsby-highlight-code-line\"><span class=\"token punctuation\">}</span></span>\n<span class=\"token function\">it</span><span class=\"token punctuation\">(</span><span class=\"token string\">'renders correctly'</span><span class=\"token punctuation\">,</span> <span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">=></span> <span class=\"token punctuation\">{</span>\n  <span class=\"token keyword\">const</span> options <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span>createNodeMock<span class=\"token punctuation\">}</span><span class=\"token punctuation\">;</span>\n<span class=\"gatsby-highlight-code-line\">  <span class=\"token keyword\">const</span> tree <span class=\"token operator\">=</span> renderer<span class=\"token punctuation\">.</span><span class=\"token function\">create</span><span class=\"token punctuation\">(</span><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;</span><span class=\"token class-name\">MyInput</span></span> <span class=\"token punctuation\">/></span></span><span class=\"token punctuation\">,</span> options<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></span>  <span class=\"token function\">expect</span><span class=\"token punctuation\">(</span>tree<span class=\"token punctuation\">)</span><span class=\"token punctuation\">.</span><span class=\"token function\">toMatchSnapshot</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>We would like to thank <a href=\"https://github.com/Aweary\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Brandon Dail</a> for implementing this feature.</p>\n<p>You can learn more about snapshot testing in <a href=\"https://facebook.github.io/jest/blog/2016/07/27/jest-14.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">this Jest blog post</a>.</p>\n<hr>\n<h2 id=\"installation\"><a href=\"#installation\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Installation </h2>\n<p>We recommend using <a href=\"https://yarnpkg.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Yarn</a> or <a href=\"https://www.npmjs.com/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">npm</a> for managing front-end dependencies. If you’re new to package managers, the <a href=\"https://yarnpkg.com/en/docs/getting-started\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Yarn documentation</a> is a good place to get started.</p>\n<p>To install React with Yarn, run:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"gatsby-code-bash\"><code class=\"gatsby-code-bash\"><span class=\"token function\">yarn</span> <span class=\"token function\">add</span> react@15.4.0 react-dom@15.4.0</code></pre></div>\n<p>To install React with npm, run:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"gatsby-code-bash\"><code class=\"gatsby-code-bash\"><span class=\"token function\">npm</span> <span class=\"token function\">install</span> --save react@15.4.0 react-dom@15.4.0</code></pre></div>\n<p>We recommend using a bundler like <a href=\"https://webpack.js.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">webpack</a> or <a href=\"http://browserify.org/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Browserify</a> so you can write modular code and bundle it together into small packages to optimize load time.</p>\n<p>Remember that by default, React runs extra checks and provides helpful warnings in development mode. When deploying your app, make sure to <a href=\"/docs/installation.html#development-and-production-versions\">compile it in production mode</a>.</p>\n<p>In case you don’t use a bundler, we also provide pre-built bundles in the npm packages which you can <a href=\"/docs/installation.html#using-a-cdn\">include as script tags</a> on your page:</p>\n<ul>\n<li><strong>React</strong><br>\nDev build with warnings: <a href=\"https://unpkg.com/react@15.4.0/dist/react.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react/dist/react.js</a><br>\nMinified build for production: <a href=\"https://unpkg.com/react@15.4.0/dist/react.min.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react/dist/react.min.js</a>  </li>\n<li><strong>React with Add-Ons</strong><br>\nDev build with warnings: <a href=\"https://unpkg.com/react@15.4.0/dist/react-with-addons.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react/dist/react-with-addons.js</a><br>\nMinified build for production: <a href=\"https://unpkg.com/react@15.4.0/dist/react-with-addons.min.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react/dist/react-with-addons.min.js</a>  </li>\n<li><strong>React DOM</strong> (include React in the page before React DOM)<br>\nDev build with warnings: <a href=\"https://unpkg.com/react-dom@15.4.0/dist/react-dom.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-dom/dist/react-dom.js</a><br>\nMinified build for production: <a href=\"https://unpkg.com/react-dom@15.4.0/dist/react-dom.min.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-dom/dist/react-dom.min.js</a>  </li>\n<li><strong>React DOM Server</strong> (include React in the page before React DOM Server)<br>\nDev build with warnings: <a href=\"https://unpkg.com/react-dom@15.4.0/dist/react-dom-server.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-dom/dist/react-dom-server.js</a><br>\nMinified build for production: <a href=\"https://unpkg.com/react-dom@15.4.0/dist/react-dom-server.min.js\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">react-dom/dist/react-dom-server.min.js</a></li>\n</ul>\n<p>We’ve also published version <code class=\"gatsby-code-text\">15.4.0</code> of the <code class=\"gatsby-code-text\">react</code>, <code class=\"gatsby-code-text\">react-dom</code>, and addons packages on npm and the <code class=\"gatsby-code-text\">react</code> package on bower.</p>\n<hr>\n<h2 id=\"changelog\"><a href=\"#changelog\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Changelog </h2>\n<h3 id=\"react\"><a href=\"#react\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>React </h3>\n<ul>\n<li>React package and browser build no longer “secretly” includes React DOM.<br>\n<small>(<a href=\"https://github.com/sebmarkbage\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@sebmarkbage</a> in <a href=\"https://github.com/facebook/react/pull/7164\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7164</a> and <a href=\"https://github.com/facebook/react/pull/7168\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7168</a>)</small></li>\n<li>Required PropTypes now fail with specific messages for null and undefined.<br>\n<small>(<a href=\"https://github.com/chenglou\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@chenglou</a> in <a href=\"https://github.com/facebook/react/pull/7291\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7291</a>)</small></li>\n<li>Improved development performance by freezing children instead of copying.<br>\n<small>(<a href=\"https://github.com/keyanzhang\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@keyanzhang</a> in <a href=\"https://github.com/facebook/react/pull/7455\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7455</a>)</small></li>\n</ul>\n<h3 id=\"react-dom\"><a href=\"#react-dom\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>React DOM </h3>\n<ul>\n<li>Fixed occasional test failures when React DOM is used together with shallow renderer.<br>\n<small>(<a href=\"https://github.com/goatslacker\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@goatslacker</a> in <a href=\"https://github.com/facebook/react/pull/8097\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#8097</a>)</small></li>\n<li>Added a warning for invalid <code class=\"gatsby-code-text\">aria-</code> attributes.<br>\n<small>(<a href=\"https://github.com/jessebeach\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@jessebeach</a> in <a href=\"https://github.com/facebook/react/pull/7744\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7744</a>)</small></li>\n<li>Added a warning for using <code class=\"gatsby-code-text\">autofocus</code> rather than <code class=\"gatsby-code-text\">autoFocus</code>.<br>\n<small>(<a href=\"https://github.com/hkal\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@hkal</a> in <a href=\"https://github.com/facebook/react/pull/7694\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7694</a>)</small></li>\n<li>Removed an unnecessary warning about polyfilling <code class=\"gatsby-code-text\">String.prototype.split</code>.<br>\n<small>(<a href=\"https://github.com/nhunzaker\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@nhunzaker</a> in <a href=\"https://github.com/facebook/react/pull/7629\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7629</a>)</small></li>\n<li>Clarified the warning about not calling PropTypes manually.<br>\n<small>(<a href=\"https://github.com/jedwards1211\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@jedwards1211</a> in <a href=\"https://github.com/facebook/react/pull/7777\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7777</a>)</small></li>\n<li>The unstable <code class=\"gatsby-code-text\">batchedUpdates</code> API now passes the wrapped function’s return value through.<br>\n<small>(<a href=\"https://github.com/bgnorlov\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@bgnorlov</a> in <a href=\"https://github.com/facebook/react/pull/7444\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7444</a>)</small></li>\n<li>Fixed a bug with updating text in IE 8.<br>\n<small>(<a href=\"https://github.com/mnpenner\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@mnpenner</a> in <a href=\"https://github.com/facebook/react/pull/7832\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7832</a>)</small></li>\n</ul>\n<h3 id=\"react-perf\"><a href=\"#react-perf\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>React Perf </h3>\n<ul>\n<li>When ReactPerf is started, you can now view the relative time spent in components as a chart in Chrome Timeline.<br>\n<small>(<a href=\"https://github.com/gaearon\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@gaearon</a> in <a href=\"https://github.com/facebook/react/pull/7549\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7549</a>)</small></li>\n</ul>\n<h3 id=\"react-test-utils\"><a href=\"#react-test-utils\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>React Test Utils </h3>\n<ul>\n<li>If you call <code class=\"gatsby-code-text\">Simulate.click()</code> on a <code class=\"gatsby-code-text\">&lt;input disabled onClick={foo} /&gt;</code> then <code class=\"gatsby-code-text\">foo</code> will get called whereas it didn’t before.<br>\n<small>(<a href=\"https://github.com/nhunzaker\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@nhunzaker</a> in <a href=\"https://github.com/facebook/react/pull/7642\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7642</a>)</small></li>\n</ul>\n<h3 id=\"react-test-renderer\"><a href=\"#react-test-renderer\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>React Test Renderer </h3>\n<ul>\n<li>Due to packaging changes, it no longer crashes when imported together with React DOM in the same file.<br>\n<small>(<a href=\"https://github.com/sebmarkbage\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@sebmarkbage</a> in <a href=\"https://github.com/facebook/react/pull/7164\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7164</a> and <a href=\"https://github.com/facebook/react/pull/7168\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7168</a>)</small></li>\n<li><code class=\"gatsby-code-text\">ReactTestRenderer.create()</code> now accepts <code class=\"gatsby-code-text\">{createNodeMock: element =&gt; mock}</code> as an optional argument so you can mock refs with snapshot testing.<br>\n<small>(<a href=\"https://github.com/Aweary\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">@Aweary</a> in <a href=\"https://github.com/facebook/react/pull/7649\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#7649</a> and <a href=\"https://github.com/facebook/react/pull/8261\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">#8261</a>)</small></li>\n</ul>","excerpt":"Today we are releasing React 15.4.0. We didn’t announce the previous minor releases 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. Separating React and React DOM  More than a year ago, we started separating React and React DOM into separate packages. We deprecated  in favor of  in React 0.14, and removed DOM-specific APIs from  completely in React 15. However, the React DOM implementation…","frontmatter":{"title":"React v15.4.0","next":null,"prev":null,"author":[{"frontmatter":{"name":"Dan Abramov","url":"https://twitter.com/dan_abramov"}}]},"fields":{"date":"November 16, 2016","path":"content/blog/2016-11-16-react-v15.4.0.md","slug":"/blog/2016/11/16/react-v15.4.0.html"}},"allMarkdownRemark":{"edges":[{"node":{"frontmatter":{"title":"Introducing the New JSX Transform"},"fields":{"slug":"/blog/2020/09/22/introducing-the-new-jsx-transform.html"}}},{"node":{"frontmatter":{"title":"React v17.0 Release Candidate: No New Features"},"fields":{"slug":"/blog/2020/08/10/react-v17-rc.html"}}},{"node":{"frontmatter":{"title":"React v16.13.0"},"fields":{"slug":"/blog/2020/02/26/react-v16.13.0.html"}}},{"node":{"frontmatter":{"title":"Building Great User Experiences with Concurrent Mode and Suspense"},"fields":{"slug":"/blog/2019/11/06/building-great-user-experiences-with-concurrent-mode-and-suspense.html"}}},{"node":{"frontmatter":{"title":"Preparing for the Future with React Prereleases"},"fields":{"slug":"/blog/2019/10/22/react-release-channels.html"}}},{"node":{"frontmatter":{"title":"Introducing the New React DevTools"},"fields":{"slug":"/blog/2019/08/15/new-react-devtools.html"}}},{"node":{"frontmatter":{"title":"React v16.9.0 and the Roadmap Update"},"fields":{"slug":"/blog/2019/08/08/react-v16.9.0.html"}}},{"node":{"frontmatter":{"title":"Is React Translated Yet? ¡Sí! Sim! はい！"},"fields":{"slug":"/blog/2019/02/23/is-react-translated-yet.html"}}},{"node":{"frontmatter":{"title":"React v16.8: The One With Hooks"},"fields":{"slug":"/blog/2019/02/06/react-v16.8.0.html"}}},{"node":{"frontmatter":{"title":"React v16.7: No, This Is Not the One With Hooks"},"fields":{"slug":"/blog/2018/12/19/react-v-16-7.html"}}}]}},"pageContext":{"slug":"/blog/2016/11/16/react-v15.4.0.html"}},"staticQueryHashes":[]}