Update dependency react to v15#30
Open
dev-mend-for-github-com[bot] wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
~0.13.3→~15.0.0By merging this PR, the below vulnerabilities will be automatically resolved:
Release Notes
facebook/react (react)
v15.0.0Compare Source
Major changes
document.createElementinstead of generating HTML. Previously we would generate a large string of HTML and then setnode.innerHTML. At the time, this was decided to be faster than usingdocument.createElementfor the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By usingcreateElementwe can make other parts of React faster. (@sophiebits in #5205)data-reactidis no longer on every node. As a result of usingdocument.createElement, we can prime the node cache as we create DOM nodes, allowing us to skip a potential lookup (which used thedata-reactidattribute). Root nodes will have adata-reactrootattribute and server generated markup will still containdata-reactid. (@sophiebits in #5205)<span>s. ReactDOM will now 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. If you were targeting these<span>s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components. (@mwiencek in #5753)nullnow uses comment nodes. Previouslynullwould render to<noscript>elements. We now use comment nodes. This may cause issues if making use of:nth-childCSS selectors. While we consider this rendering behavior an implementation detail of React, it's worth noting the potential problem. (@sophiebits in #5451)null. We added support for defining stateless components as functions in React 0.14. However, React 0.14 still allowed you to define a class component without extendingReact.Componentor usingReact.createClass(), so we couldn’t reliably tell if your component is a function or a class, and did not allow returningnullfrom it. This issue is solved in React 15, and you can now returnnullfrom any component, whether it is a class or a function. (@jimfb in #5884)React.DOMelement helper, but JSX andReact.createElementwork 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 let us know in this issue. (@zpao in #6243)Breaking changes
<span>s.React.cloneElement()now resolvesdefaultProps. We fixed a bug inReact.cloneElement()that some components may rely on. If some of thepropsreceived bycloneElement()areundefined, it used to return an element withundefinedvalues for those props. We’re changing it to be consistent withcreateElement(). Now anyundefinedprops passed tocloneElement()are resolved to the corresponding component’sdefaultProps. (@truongduy134 in #5997)ReactPerf.getLastMeasurements()is opaque. This change won’t affect applications but may break some third-party tools. We are revampingReactPerfimplementation 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 ofReactPerf.getLastMeasurements()an opaque data structure that should not be relied upon. (@gaearon in #6286)Removed deprecations
These deprecations were introduced nine months ago in v0.14 with a warning and are removed:
Reacttop-level export:findDOMNode,render,renderToString,renderToStaticMarkup, andunmountComponentAtNode. As a reminder, they are now available onReactDOMandReactDOMServer. (@jimfb in #5832)batchedUpdatesandcloneWithProps. (@jimfb in #5859, @zpao in #6016)setProps,replaceProps, andgetDOMNode. (@jimfb in #5570)react/addonsentry point is removed. As a reminder, you should use separatereact-addons-*packages instead. This only applies if you use the CommonJS builds. (@gaearon in #6285)childrento void elements like<input>was deprecated, and now throws an error. (@jonhester in #3372)refs(e.g.this.refs.div.props) were deprecated, and are removed now. (@jimfb in #5495)New deprecations, introduced with a warning
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.
LinkedStateMixinandvalueLinkare now deprecated due to very low popularity. If you need this, you can use a wrapper component that implements the same behavior: react-linked-input. (@jimfb in #6127)<input value={null}>as a request to clear the input. However, React 0.14 has been ignoringvalue={null}. React 15 warns you on anullinput 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 passundefinedto make the input uncontrolled. (@antoaravinth in #5048)ReactPerf.printDOM()was renamed toReactPerf.printOperations(), andReactPerf.getMeasurementsSummaryMap()was renamed toReactPerf.getWasted(). (@gaearon in #6287)New helpful warnings
pxautomatically. This version now warns in this case (ex: writingstyle={{width: '300'}}. Unitless number values likewidth: 300are unchanged. (@pluma in #5140)refandkeyfrom the props. (@prometheansacrifice in #5744)propsobject tosuper()in the constructor. (@prometheansacrifice in #5346)setState()insidegetChildContext(). (@raineroviir in #6121)onclickwhich should beonClick. (@ali in #5361)NaNvalues instyle. (@jontewks in #5811)valueanddefaultValuefor an input. (@mgmcdermott in #5823)onFocusInoronFocusOuthandlers as they are unnecessary in React. (@jontewks in #6296)ReactDOM.render(),this.setState(), orthis.forceUpdate(). (@conorhastings in #5193 and @gaearon in #6310)TestUtils.Simulate()now prints a helpful message if you attempt to use it with shallow rendering. (@conorhastings in #5358)arrayOf()andobjectOf()provide better error messages for invalid arguments. (@chicoxyzzy in #5390)Notable bug fixes
componentWillReceiveProps()lifecycle method is now consistently called whencontextchanges. (@milesj in #5787)React.cloneElement()doesn’t append slash to an existingkeywhen used insideReact.Children.map(). (@ianobermiller in #5892)citeandprofileHTML attributes. (@AprilArcus in #6094 and @saiichihashimoto in #6032)cssFloat,gridRowandgridColumnCSS properties. (@stevenvachon in #6133 and @mnordick in #4779)borderImageOutset,borderImageWidth,borderImageSlice,floodOpacity,strokeDasharray, andstrokeMiterlimitas unitless CSS properties. (@rofrischmann in #6210 and #6270)onAnimationStart,onAnimationEnd,onAnimationIteration,onTransitionEnd, andonInvalidevents. Support foronLoadhas been added toobjectelements. (@tomduncalf in #5187, @milesj in #6005, and @ara4n in #5781)href={null}) now results in the forceful removal, no longer trying to set to the default value used by browsers in the absence of a value. (@syranide in #1510)childrento strings for Web Components. (@jimfb in #5093)<use>events. (@edmellum in #5720)<select>is unmounted while itsonChangehandler is executing. (@sambev in #6028)ref. (@yiminghe in #6095)Object.isis used in a number of places to compare values, which leads to fewer false positives, especially involvingNaN. In particular, this affects theshallowCompareadd-on. (@chicoxyzzy in #6132)Other improvements
loose-envifyinstead ofenvifyso it installs fewer transitive dependencies. (@qerub in #6303)getMountedInstance(). (@glenjamin in #4918)render(). (@simonewebdesign in #5411)Object.createandObject.freezein older environments. It still, however, requires ES5 shims in those environments. (@dgreensp in #4959)data-attributes with names that start with numbers. (@nLight in #5216)suppressContentEditableWarningprop for components like Draft.js that intentionally managecontentEditablechildren with React. (@mxstbr in #6112)createClass()on complex specs. (@sophiebits in #5550)v0.14.10React
v0.14.8Compare Source
React
v0.14.7Compare Source
React
<option>tags when usingdangerouslySetInnerHTMLReact TestUtils Add-on
setStateincomponentWillMountwhen using shallow renderingv0.14.6Compare Source
React
fbjsdependency to pick up change affecting handling of undefined document.v0.14.5Compare Source
React
v0.14.4Compare Source
React
React DOM
autoCapitalizeandautoCorrectprops are now set as attributes in the DOM instead of properties to improve cross-browser compatibility<select>elements not handling updates properlyReact Perf Add-on
.printDOM()v0.14.3Compare Source
React DOM
nonceattribute for<script>and<style>elementsreversedattribute for<ol>elementsReact TestUtils Add-on
React CSSTransitionGroup Add-on
React on Bower
react-dom-server.jsto exposerenderToStringandrenderToStaticMarkupfor usage in the browserv0.14.2Compare Source
React DOM
integrityattributechildrenprop being coerced to a string for custom elements, which was not the desired behaviorreactfromdependenciestopeerDependenciesto match expectations and align withreact-addons-*packagesv0.14.1Compare Source
React
v0.14.0Compare Source
Major changes
reactpackage into two:reactandreact-dom. This paves the way to writing components that can be shared between the web version of React and React Native. This means you will need to include both files and some functions have been moved fromReacttoReactDOM.react-addons-clone-with-props,react-addons-create-fragment,react-addons-css-transition-group,react-addons-linked-state-mixin,react-addons-perf,react-addons-pure-render-mixin,react-addons-shallow-compare,react-addons-test-utils,react-addons-transition-group,react-addons-update,ReactDOM.unstable_batchedUpdates).props) which returns a JSX element, and this function may be used as a component.getDOMNode()to get the underlying DOM node. Starting with this release, a ref to a DOM component is the actual DOM node. Note that refs to custom (user-defined) components work exactly as before; only the built-in DOM components are affected by this change.Breaking changes
React.initializeTouchEventsis no longer necessary and has been removed completely. Touch events now work automatically.TestUtils.findAllInRenderedTreeand related helpers are no longer able to take a DOM component, only a custom component.propsobject is now frozen, so mutating props after creating a component element is no longer supported. In most cases,React.cloneElementshould be used instead. This change makes your components easier to reason about and enables the compiler optimizations mentioned above.createFragmenthelper to migrate, which now returns an array.classSethas been removed. Use classnames instead.classinstead ofclassName.Deprecations
this.getDOMNode()is now deprecated andReactDOM.findDOMNode(this)can be used instead. Note that in the common case,findDOMNodeis now unnecessary since a ref to the DOM component is now the actual DOM node.setPropsandreplacePropsare now deprecated. Instead, call ReactDOM.render again at the top level with the new props.React.Componentin order to enable stateless function components. The ES3 module pattern will continue to work.styleobject between renders has been deprecated. This mirrors our change to freeze thepropsobject.cloneWithPropsis now deprecated. UseReact.cloneElementinstead (unlikecloneWithProps,cloneElementdoes not mergeclassNameorstyleautomatically; you can merge them manually if needed).CSSTransitionGroupwill no longer listen to transition events. Instead, you should specify transition durations manually using props such astransitionEnterTimeout={500}.Notable enhancements
React.Children.toArraywhich takes a nested children object and returns a flat array with keys assigned to each child. This helper makes it easier to manipulate collections of children in yourrendermethods, especially if you want to reorder or slicethis.props.childrenbefore passing it down. In addition,React.Children.mapnow returns plain arrays too.console.errorinstead ofconsole.warnfor warnings so that browsers show a full stack trace in the console. (Our warnings appear when you use patterns that will break in future releases and for code that is likely to behave unexpectedly, so we do consider our warnings to be “must-fix” errors.)Symbolin browsers that support it, in order to ensure that React never considers untrusted JSON to be a valid element. If this extra security protection is important to you, you should add aSymbolpolyfill for older browsers, such as the one included by Babel’s polyfill.capture,challenge,inputMode,is,keyParams,keyType,minLength,summary,wrap. It also now supports these non-standard attributes:autoSave,results,security.xlinkActuate,xlinkArcrole,xlinkHref,xlinkRole,xlinkShow,xlinkTitle,xlinkType,xmlBase,xmlLang,xmlSpace.imageSVG tag is now supported by React DOM.is="..."attribute).audioandvideotags:onAbort,onCanPlay,onCanPlayThrough,onDurationChange,onEmptied,onEncrypted,onEnded,onError,onLoadedData,onLoadedMetadata,onLoadStart,onPause,onPlay,onPlaying,onProgress,onRateChange,onSeeked,onSeeking,onStalled,onSuspend,onTimeUpdate,onVolumeChange,onWaiting.shallowCompareadd-on has been added as a migration path forPureRenderMixinin ES6 classes.CSSTransitionGroupcan now use custom class names instead of appending-enter-activeor similar to the transition name.New helpful warnings
document.bodydirectly as the container toReactDOM.rendernow gives a warning as doing so can cause problems with browser extensions that modify the DOM.Notable bug fixes
<option>elements with multiple text children properly and renders<select>elements on the server with the correct option selected.React.createElement('DIV')) no longer causes problems, though we continue to recommend lowercase for consistency with the JSX tag name convention (lowercase names refer to built-in components, capitalized names refer to custom components).animationIterationCount,boxOrdinalGroup,flexOrder,tabSize,stopOpacity.Simulate.mouseEnterandSimulate.mouseLeavenow work.React Tools / Babel
Breaking Changes
react-toolspackage andJSXTransformer.jsbrowser file have been deprecated. You can continue using version0.13.3of both, but we no longer support them and recommend migrating to Babel, which has built-in support for React and JSX.New Features
optimisation.react.inlineElementstransform converts JSX elements to object literals like{type: 'div', props: ...}instead of calls toReact.createElement. This should only be enabled in production, since it disables some development warnings/checks.optimisation.react.constantElementstransform hoists element creation to the top level for subtrees that are fully static, which reduces calls toReact.createElementand the resulting allocations. More importantly, it tells React that the subtree hasn’t changed so React can completely skip it when reconciling. This should only be enabled in production, since it disables some development warnings/checks.