storybookjs/storybook

[Investigation]: Support React 19

yannbf opened this issue · 21 comments

Describe the bug

React 19 has been released. We should investigate all the changes that are needed to fully support it.

  • Make sure that React 19 is supported in all packages that have it as peer dependency
    • @storybook/ember
    • @storybook/addon-links
    • @storybook/blocks
    • @storybook/react
    • @storybook/react-vite
    • @storybook/react-webpack5
    • @storybook/react-dom-shim
    • @storybook/react-webpack
    • @storybook/experimental-nextjs-vite
    • @storybook/react-native-web-vite
    • @storybook/nextjs
    • @storybook/icons
  • Get react-confetti (dep of @storybook/addon-onboarding) to support React 19: alampros/react-confetti#159
  • Make sure React 19 features are tested in sandboxes
  • Update usage of act in places like this

To users:

You should be able to use Storybook with React 19, but if you found any inconsistency or unsupported feature, please let us know in this issue.

I don't think we want to upgrade any direct dependencies, as that would be a breaking change, at least if we did it in @storybook/addon-docs or storybook.
We also shouldn't upgrade devDependencies in addons, and especially not addon-kit, because the manager will still be using React 18, so the addons' React version is ignored. Meaning if you're building an addon with React 19 APIs, they won't work as soon as that addon is bundled into the manager at runtime.

it's released now

Would appreciate if these peerDependencies could be updated to support the released version:

"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",

Hey @silverwind they should support both React 19 prereleases and ^19.0.0. Are you having any problems?

Ah, you are right, it's not an issue. I wasn't aware that prerelease ranges are satisified by release versions. This works with npm for me without getting a peerDependencies error:

{
  "dependencies": {
    "@storybook/react": "8.4.7",
    "react": "19.0.0"
  }
}