Legacy React APIs
These APIs are exported from the react
package, but they are not recommended for use in newly written code. See the linked individual API pages for the suggested alternatives.
Legacy APIs
Children
lets you manipulate and transform the JSX received as thechildren
prop. See alternatives.cloneElement
lets you create a React element using another element as a starting point. See alternatives.Component
lets you define a React component as a JavaScript class. See alternatives.createElement
lets you create a React element. Typically, you’ll use JSX instead.createRef
creates a ref object which can contain arbitrary value. See alternatives.forwardRef
lets your component expose a DOM node to parent component with a ref.isValidElement
checks whether a value is a React element. Typically used withcloneElement
.PureComponent
is similar toComponent
, but it skip re-renders with same props. See alternatives.
Removed APIs
These APIs were removed in React 19:
createFactory
: use JSX instead.- Class Components:
static contextTypes
: usestatic contextType
instead. - Class Components:
static childContextTypes
: usestatic contextType
instead. - Class Components:
static getChildContext
: useContext.Provider
instead. - Class Components:
static propTypes
: use a type system like TypeScript instead. - Class Components:
this.refs
: usecreateRef
instead.