reactjs / react-transition-group

An easy way to perform animations when a React component enters or leaves the DOM
https://reactcommunity.org/react-transition-group/
Other
10.14k stars 651 forks source link

JSX transform incompatible with React 19 #909

Open pzaczkiewicz-athenahealth opened 2 weeks ago

pzaczkiewicz-athenahealth commented 2 weeks ago

What is the current behavior?

JSX transform uses React.createElement, which is incompatible with React 19: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing

This is somewhat premature, as React 19 isn't out of canary status yet, but component libraries should adapt prior to React 19 getting out of canary status.

What is the expected behavior?

Able to use with React 19

Arkellys commented 2 weeks ago

I'm using the library with React 19 RC with no problem, do you get errors?

pzaczkiewicz-athenahealth commented 1 week ago

No, I haven't tried using react-transition-group with React 19. I maintain a design system, which uses react-transition-group as a dependency. While reviewing the documented breaking changes for React 19, I came across the JSX transform deprecation. While I linked to the documentation, I'll repeat here:

New JSX Transform is now required We introduced a new JSX transform in 2020 to improve bundle size and use JSX without importing React. In React 19, we’re adding additional improvements like using ref as a prop and JSX speed improvements that require the new transform.

If the new transform is not enabled, you will see this warning:

Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform We expect most apps will not be affected since the transform is enabled in most environments already. For manual instructions on how to upgrade, please see the announcement post.

Reading between the lines, "Required" doesn't seem to mean "will be deleted from React" given that it's meant to generate a console error. I've inspected the build artefacts for react-transition-group and it's definitely using React.createElement in the latest version. Given that you've reported that React 19 RC doesn't report this console error, it seems that the documentation is ahead of the implementation. Maybe it won't actually be a console error when React 19 is finally released, but this signals that React.createElement will eventually be officially deprecated, and later removed.

That definitely makes this "issue" speculation, but it should also be a small change.