Skip to content

Upgrading react 0.11 to 0.12

Breaking0.11.2 → 0.12.2Breaking8Deprecated11New7Changed7Fixed9Other1

BreakingUpgrade verdict

8 breaking changes.

  • Default values for props are now fixed when the element is created, not when it is mounted.
  • An internal-only API is gone; the developer tools no longer rely on it.
  • You can no longer call a component function directly; wrap it in a factory, or just use JSX which does it for you.
  • Passing scrollLeft or scrollTop as props no longer works; set them on the DOM node instead.
Top 5 of 19 that need code or config changes

Installs 34 packages in all (was 9).

Breaking8
Moves default prop resolution to element creation time instead of mount time, making defaults effectively static.
getDefaultProps
Removes React.__internals, which was exposed for DevTools that no longer needs access.
React.__internals
Composite component functions can no longer be called directly and must be wrapped with React.createFactory first, which JSX handles automatically.
React.createFactory
Removes scrollLeft and scrollTop props, which should not be specified as props.
scrollLeftscrollTop
React.addons.update now uses assign instead of copyProperties with hasOwnProperty checks, so prototype properties are no longer updated correctly.
React.addons.updateassigncopyPropertieshasOwnProperty
JSX no longer transforms to simple function calls.
Moves key and ref off the props object so they are now accessible on the element directly.
keyrefprops
Enforces that lower case JSX tag names are always HTML tags and upper case tag names are always composite components.
Deprecated11
Deprecates React.renderComponent in favor of React.render.
React.renderComponentReact.render
Deprecates React.renderComponentToString in favor of React.renderToString.
React.renderComponentToStringReact.renderToString
Deprecates React.renderComponentToStaticMarkup in favor of React.renderToStaticMarkup.
React.renderComponentToStaticMarkupReact.renderToStaticMarkup
Deprecates React.isValidComponent in favor of React.isValidElement.
React.isValidComponentReact.isValidElement
Deprecates React.PropTypes.component in favor of React.PropTypes.element.
React.PropTypes.componentReact.PropTypes.element
Deprecates React.PropTypes.renderable in favor of React.PropTypes.node.
React.PropTypes.renderableReact.PropTypes.node
Deprecates React.isValidClass.
React.isValidClass
Deprecates instance.transferPropsTo.
instance.transferPropsTo
Deprecates returning false from event handlers to preventDefault.
preventDefault
Deprecates convenience constructor usage as a function; wrap with React.createFactory instead.
React.createFactory
Deprecates use of key={null} to assign implicit keys.
key