react breaking changes

npm

5 curated breaking changes across major versions of react. Use this as a migration checklist before bumping dependencies.

5
changes
Breaking changes by transition
  • 18 \u2192 19api

    useFormState renamed to useActionState and moved from react-dom to react.

    Migration

    `import { useActionState } from 'react'` (was `useFormState` from react-dom). Signature is identical.

  • 18 \u2192 19api

    ref is now a regular prop on function components; forwardRef no longer required for most cases.

    Migration

    Remove forwardRef wrappers: `const Foo = ({ ref, ...props }) => ...`. Keep forwardRef only if you export to an external lib that still expects it.

  • 18 \u2192 19removal

    propTypes and contextTypes on class components silently ignored in production.

    Migration

    Migrate validation to TypeScript. Remove propTypes usage; keep only if you target React 18 simultaneously via a lib.

  • 18 \u2192 19removal

    defaultProps on function components removed. Use JavaScript default parameters instead.

    Migration

    Replace `Foo.defaultProps = { size: 'md' }` with `function Foo({ size = 'md' })`.

  • 18 \u2192 19removal

    String refs removed completely (were deprecated since v16).

    Migration

    Use callback refs or useRef. `ref="myRef"` is no longer supported.

API access

Get this data programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/breaking/npm/react
react breaking changes — npm migration guide | DepScope