Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

React 19 and Sanity

Support for React 19 in Sanity Studio and official plugins are being worked on. Progress can be tracked on this page.

Sanity in Next.js 15

You can use Sanity in Next.js 15 by downgrading the React dependencies to version 18.

Next.js 15 will still use React 19, but this will ensure compatibility with other packages depending on React 18. Run the following command to install this version of React.

npm install react@18 react-dom@18 --legacy-peer-deps 

Your package.json should now show react and react-dom as

"dependencies": {
  "react": "^18.3.1",
  "react-dom": "^18.3.1",
  // ...all other packages
}

When is it safe to use React 19 in production?

It depends on the plugins you use. Our release strategy is to:

  1. Update upstream libraries that Sanity Studio depends on with React 19 support (@sanity/ui, react-rx, and others).
  2. Release a new version of Sanity Studio that adds React 19 to its peerDependencies and passes the build test.
  3. Update @sanity/plugin-kit with support for React 19, and provide docs for plugin authors for how to test, verify and release a new version.
  4. Release new versions of official plugins that adds React 19 to its peerDependencies.
  5. Help third party plugin authors with upgrading their plugins to add React 19.

How can I prepare for React 19 today?

Make sure you’ve upgraded to React 18.3 or later, and that you don’t have any deprecation warnings logged to your console when running sanity dev .

Also ensure you have reactStrictMode enabled and don’t have strict mode related warnings either.

How can I test React 19?

Depending on your package manager you may get peer dependency errors or warnings that prevent you from being able to test 19. Here’s how you can configure your package manager to let you test 19 today:

npm

Version v10 is recommended.

Start by adding these overrides to your package.json :

{
  "dependencies": {
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "sanity": "^3.43.0",
  },
  "packageManager": "npm@10.5.2",
  "overrides": {
    "react": "$react",
    "react-dom": "$react-dom"
  }
}

Run npm install and you shouldn’t see any errors. Next, upgrade react and react-dom :

npm i react@rc react-dom@rc --save-exact

pnpm

Version v9 is recommended.

Start by adding an overrides field that ensures you don't get both v18 and v19 of react installed:

{
  "dependencies": {
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "sanity": "^3.43.0",
  },
  "packageManager": "pnpm@9.0.4",
  "pnpm": {
    "pnpm": {
      "peerDependencyRules": {
        "allowAny": [
          "react",
          "react-dom"
        ]
      }
    }
  }
}

Then run:

pnpm up react@rc react-dom@rc

Bun

v1 or later is recommended.

bun add react@rc react-dom@rc

Yarn

v1 is recommended.

yarn add react@rc react-dom@rc

Was this article helpful?