The third React 16 RC is now available for public testing. 🎉
Installation InstructionsThe RC has been published to NPM with the tag "next". Regular NPM installs will continue to use the 15.6 release. To install the RC use:
yarn add react@next react-dom@next
Or:
npm install --save react@next react-dom@next
What Does React 16 Mean for You?
React 16 is the first release that ships with a rewrite of the React core (previously codenamed “Fiber”). This rewrite had a few goals:
This initial React 16.0 release is mostly focused on compatibility with existing apps. It does not enable asynchronous rendering yet. We will introduce an opt-in to the async mode later during React 16.x. We don’t expect React 16.0 to make your apps significantly faster or slower, but we’d love to know if you see improvements or regressions.
JavaScript Environment RequirementsReact 16 depends on the collection types Map and Set. If you support older browsers and devices which may not yet provide these natively (eg <IE11), consider including a global polyfill in your bundled application, such as core-js or babel-polyfill.
A polyfilled environment for React 16 using core-js to support older browsers might look like:
import 'core-js/es6/map'; import 'core-js/es6/set'; import React from 'react'; import ReactDOM from 'react-dom'; ReactDOM.render( <h1>Hello, world!</h1>, document.getElementById('root') );
React also depends on requestAnimationFrame
(even in test environments). A simple shim for testing environments would be:
global.requestAnimationFrame = function(callback) {
setTimeout(callback, 0);
};
Points of Interest
ReactDOMServer.renderToNodeStream()
and ReactDOMServer.renderToStaticNodeStream()
). Server rendering does not use markup validation anymore, and instead tries its best to attach to existing DOM, warning about inconsistencies. And there is no data-reactid
anymore! This server renderer code is still very new, so it is likely to have issues. Please report them.ReactDOM.hydrate
instead of ReactDOM.render
if you're reviving server rendered HTML. Keep using ReactDOM.render
if you're just doing client-side rendering.unstable_handleError
, but has been renamed to componentDidCatch
.You can learn more about the new error handling behavior here.
Scheduling and LifecycleReactDOM.render()
and ReactDOM.unstable_renderIntoContainer()
now return null
if called from inside a lifecycle method.
setState
:
setState
with null no longer triggers an update. This allows you to decide in an updater function if you want to re-render.setState
directly in render always causes an update. This was not previously the case. Regardless, you should not be calling setState from render.setState
callback (second argument) now fires immediately after componentDidMount
/ componentDidUpdate
instead of after all components have rendered.<A />
with <B />
, B.componentWillMount
now always happens before A.componentWillUnmount
. Previously, A.componentWillUnmount
could fire first in some cases.ReactDOM.unmountComponentAtNode
. See this example.componentDidUpdate
lifecycle no longer receives prevContext
param. (See Pass prevContext param to componentDidUpdate #8631)componentDidUpdate()
because DOM refs are not available. This also makes it consistent with componentDidMount()
(which does not get called in previous versions either).unstable_batchedUpdates()
anymore.react/lib/*
and react-dom/lib/*
anymore. Even in CommonJS environments, React and ReactDOM are precompiled to single files (“flat bundles”). If you previously relied on undocumented React internals, and they don’t work anymore, let us know about your specific case in this issue, and we’ll try to figure out a migration strategy for you.react-with-addons.js
build anymore. All compatible addons are published separately on npm, and have single-file browser versions if you need them.React.createClass
is now available as create-react-class
, React.PropTypes
as prop-types
, React.DOM
as react-dom-factories
, react-addons-test-utils
as react-dom/test-utils
, and shallow renderer as react-test-renderer/shallow
. See 15.5.0 and 15.6.0 blog posts for instructions on migrating code and automated codemods.react/dist/react.js
→ react/umd/react.development.js
react/dist/react.min.js
→ react/umd/react.production.min.js
react-dom/dist/react-dom.js
→ react-dom/umd/react-dom.development.js
react-dom/dist/react-dom.min
.js → react-dom/umd/react-dom.production.min.js
16.0.0-beta.2
16.0.0-beta.3
data-reactid
somewhat unnecessarily. ( Server-rendered HTML polluted with empty data-reactid attributes #10306)
16.0.0-beta.3
context
to componentWillReceiveProps
(to be fixed by Shallow renderer passes context to componentWillReceiveProps #10342)
16.0.0-beta.3
'use strict'
in older browsers ( React 16 RC #10294 (comment))
16.0.0-beta.3
Error: null
is reported instead of the real error. ( "Error: null" in the captured error warning due to cross-origin issues #10321)
16.0.0-beta.3
16.0.0-beta.3
Released 16.0.0-beta.1
on July 24, 2017
Released 16.0.0-beta.2
on July 27, 2017
Released 16.0.0-beta.3
on August 3, 2017
Released 16.0.0-beta.4
on August 8, 2017
Release 16.0.0-beta.5
on 2017-08-08
Released 16.0.0-rc.1
on September 6, 2017
undefined is not a function (evaluating 'owner.getName()')
(@fxfactorial in Fixes #10443 #10448 and @bvaughn in RN findNodeHandle no longer adds props directly to read-only owner #10520)<select>
elements defaulted to first option, even when it was 'disabled'. (@aweary in Default to first non-disabled option for select elements #10456 and @nhunzaker in Add test fixtures to cover disabled selected options #10142)Released 16.0.0-rc.2
on September 6, 2017
const
natively (@sophiebits in Remove "const" in uncompiled code #10631)Released 16.0.0-rc.3
on September 14, 2017
TestUtils
methods (@gaearon in Remove undocumented TestUtils methods #10681)ReactDOM.createPortal()
as an “official” API without the unstable prefix (@gaearon in Make ReactDOM.createPortal() official #10675)Object.assign
polyfill twice (@gaearon in Share Object.assign polyfill between UMD builds #10671)markerikson, aweary, oliviertassinari, tiansijie, ergenekonyigit and 1766 moreroyliu2, Asgator, rtymchyk, ekokotov, fadamakis and 8 morebrowniefed, davidkpiano, andrewgrewell, felixexter, rgdelato and 194 moresophiebits, bvaughn, markerikson, aweary, eliperkins and 1024 moreaweary, bvaughn, vjeux, browniefed, gamalielhere and 28 moresophiebits, aweary, eliperkins, felipellrocha, vjeux and 506 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4