-
Notifications
You must be signed in to change notification settings - Fork 325
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
Support React 17 #436
base: master
Are you sure you want to change the base?
Support React 17 #436
Conversation
Resolves reach#429
@sfcgeorge Wrote a very nice and insightful comment in a PR that was unfortunately abandoned. Additionally, @Hypnosphi @krainboltgreene and @bcomnes gave feedback on #432. |
await prApproval(jamiebuilds/create-react-context#32) |
Thanks for doing this @haysclark looks good 👍 ➡️ I think There's a chance they'll decide it's been long enough so let's finally bump the package to v1 — then we'd have to add the And for anyone like me who can never remember NPM's package.json syntax for version ranges here are the docs and a handy visual calculator to play with 👾 |
It's a polyfill, so |
I'm happy as long as react(-dom) 17 make it into to the peer deps |
create-react-context is only is needed as a polyfill for React 15 and lower; yet, the inclusion of the library blocks React 17 support. As an "optional" peerDependency, all user needs should be fulfilled while maintaining the spirit that the React libraries (and any needed polyfills) are external to the Router library itself.
I have removed the "WIP" status from this PR, incase a maintainer wants to Approve or Close this PR. If considering merging the commit, please look at my commit note for f23f43d. I have NOT manually tested these changes with React 15, 16, and 17. Possibly an The thinking behind the change is driven by the lack of movement from the author/maintainer of create-react-context. I may be mistaken, but from what I gather, create-react-context is a polyfill, ONLY needed by React 15 users. The inclusion of the library in "dependencies" only bloats the bundle size for React 16 and 17 users. Additionally, It's definitely not a perfect solution, but the scope of this PR quickly balloons into "BREAKING CHANGES" territory when removing the create-react-context library, subsequently ending React 15 support. Naturally, there are a lot of other options, like forking create-react-context, etc; but most alternative solutions are will require a vested project maintainer. The current solution felt like the best middle-ground option... thoughts? Update: |
You can make it optional with something like this, but it will generate a warning in user's webpack builds
Please test it using the repo examples if you do it: https://github.com/reach/router/blob/master/CONTRIBUTING.md#developing-the-examples. You may need to remove |
|
@bcomnes removing I think @haysclark took a great approach, see the updated Since the peerDependency is optional I'm not sure if there will be a helpful message from NPM. And even if there is it's probably technically still a breaking change because React 15 users will have to add a line to their package.json otherwise their app will break (probably silently). So a major version may still be needed plus a changelog entry telling React 15 users they'll need to add create-react-context. |
Happy new year! Any chance we can land this? 🙏 Thank you! |
NPM 7 refuses to install this module with React 17 because of the unsatisfiable peer dependency on React 16 from |
I've published a fork of |
Thank you @haysclark I support the adoption of the fork as the upstream repo maintainers have effectively abandoned the project. |
I just want to help make this be seen as it's blocking our team from using storybook, which depends on this. |
@ryanflorence Any chance that you could look at this PR, or comment? |
@ryanflorence Pinging you again on this PR - it's been close to a year since this PR was put up and the community would love to see it approved and released! |
@haysclark, can you please yolo this over the fence? I have no control over our jenkins box, and they're using npm 7. |
This is a WIP (work in progress) PR, due to the
create-react-context
dependency still needing to be addressed. Currently, it does not have React 17 support, and the next version number has yet to be confirmed.Here are some options to handle this:
create-react-context
with React 17 support and using a||
in dependencies.Please share your thoughts and feedback.
Resolves #429