-
Notifications
You must be signed in to change notification settings - Fork 47.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: Move react-is to react/is #20099
Comments
🤡 react/packages/react-test-renderer/package.json Lines 21 to 23 in 4e5d7fa
|
Now that I think about it I think re-exporting
|
@eps1lon see #20063 (comment). |
We're probably going to recommend not using that package altogether. It doesn't work great if you consider different environments (e.g. Server Components). Given that it's not recommended, we won't make it a part of the core package. |
If |
Currently
react
andreact-is
are built using ashared/
package. That means thatreact-is
(just likereact-dom
) has to have the same version number asreact
to avoid potential issues due to different code fromshared/
.However, right now a lot of libraries are wrongly declaring
react-is
as a direct dependency1 while declaringreact
as a peer. Technically correct would be declaringreact-is
as a peer as well leading to more burden for app developers. This is slightly different to havingreact
as a peer dependency because every app developer also needsreact
as a dependency. The same doesn't always hold true forreact-is
.Since
react-is
has no dependencies it would be more ergonomically for libraries ifreact-is
would be available fromreact/is
since they already havereact
as a peer dependency. There are two possibilities for this:react-is
toreact/is
react-is
a dependency ofreact
and re-export it fromreact/is
I guess marking
react-is
as a peer would be the approach that would be more consistent. It's really just annoying for libraries but if that's what you would recommend then I'm fine with it as well.As far as I can tell this is really just a technicality right now i.e. I haven't seen any actual issues. I just stumbled over it while working on React 17 compat. So far it looks like we're in a position to declare 16.8 and 17 as the range for react in our
peerDependencies
which leaves us with a slightly awkward"react-is": "^16.8.0 || ^17.0.0"
in thedependencies
(I might be trying too hard to avoid additional peer deps).1 Popular examples include
prop-types
,react-redux
,react-router
,@material-ui/core
,next
The text was updated successfully, but these errors were encountered: