A summary of changes made to React.js since version 0.4 for easy reference
- No longer transform class to className as part of the transform! This is a breaking change - if you were using class, you must change this to className or your components will be visually broken.
No breaking changes
No breaking changes
- The lifecycle methods componentDidMount and componentDidUpdate no longer receive the root node as a parameter; use this.getDOMNode() instead
- Whenever a prop is equal to undefined, the default value returned by getDefaultProps will now be used instead
- React.unmountAndReleaseReactRootNode was previously deprecated and has now been removed
- React.renderComponentToString is now synchronous and returns the generated HTML string
- Full-page rendering (that is, rendering the tag using React) is now supported only when starting with server-rendered markup
- On mouse wheel events, deltaY is no longer negated
- When prop types validation fails, a warning is logged instead of an error thrown (with the production build of React, type checks are now skipped for performance)
- On input, select, and textarea elements, .getValue() is no longer supported; use .getDOMNode().value instead
- this.context on components is now reserved for internal use by React
- React no longer adds an owner property to each component's props object; passed-in props are now never mutated
- Passing an invalid or misspelled propTypes type now throws an error
- Boolean attributes such as disabled are rendered without a value (previously disabled="true", now simply disabled)
- Whitespace normalization has changed; now space between two tags on the same line will be preserved, while newlines between two tags will be removed
No breaking changes
- getDefaultProps() is now called once per class and shared across all instances
- MyComponent() now returns a descriptor, not an instance
- React.isValidComponent and React.PropTypes.component validate descriptors, not component instances.
- Custom propType validators should return an Error instead of logging directly
- picture is now parsed into React.DOM.picture
- key and ref moved off props object, now accessible on the element directly
- Default prop resolution has moved to Element creation time instead of mount time, making them effectively static
- React.__internals is removed - it was exposed for DevTools which no longer needs access
- Composite Component functions can no longer be called directly - they must be wrapped with React.createFactory first. This is handled for you when using JSX.
- React.renderComponent --> React.render
- React.renderComponentToString --> React.renderToString
- React.renderComponentToStaticMarkup --> React.renderToStaticMarkup
- React.isValidComponent --> React.isValidElement
- React.PropTypes.component --> React.PropTypes.element
- React.PropTypes.renderable --> React.PropTypes.node
- DEPRECATED React.isValidClass
- DEPRECATED Returning false from event handlers to preventDefault
- DEPRECATED Convenience Constructor usage as function, instead wrap with React.createFactory
- DEPRECATED use of key={null} to assign implicit keys
- Enforced convention: lower case tag names are always treated as HTML tags, upper case tag names are always treated as composite components
- JSX no longer transforms to simple function calls
- Deprecated patterns that warned in 0.12 no longer work: most prominently, calling component classes without using JSX or React.createElement and using non-component functions with JSX or createElement
- Mutating props after an element is created is deprecated and will cause warnings in development mode; future versions of React will incorporate performance optimizations assuming that props aren't mutated
- Static methods (defined in statics) are no longer autobound to the component class
- ref resolution order has changed slightly such that a ref to a component is available immediately after its componentDidMount method is called; this change should be observable only if your component calls a parent component's callback within your componentDidMount, which is an anti-pattern and should be avoided regardless
- Calls to setState in life-cycle methods are now always batched and therefore asynchronous. Previously the first call on the first mount was synchronous.
- setState and forceUpdate on an unmounted component now warns instead of throwing. That avoids a possible race condition with Promises.
- Access to most internal properties has been completely removed, including this._pendingState and this._rootNodeID.
- ComponentClass.type is deprecated. Just use ComponentClass (usually as element.type === ComponentClass).
- Some methods that are available on createClass-based components are removed or deprecated from ES6 classes (getDOMNode, replaceState, isMounted, setProps, replaceProps).
- A change was made to how some JSX was parsed, specifically around the use of > or } when inside an element. Previously it would be treated as a string but now it will be treated as a parse error. The jsx_orphaned_brackets_transformer package on npm can be used to find and fix potential issues in your JSX code.