amplify-ui
amplify-ui copied to clipboard
BREAKING CHANGE: bump the minimum React version support to 16.14.0
Description of changes
-
As we discussed earlier, there is no reason for us to support React versions before 16.14.0. This is lowest React version Studio supports and has the new JSX transform backported by React team.
-
Update our dev build to align with this minimum React version. This can prevent our release from potentially breaking customers apps that are still running on React before 17 if anything is missing from React 16 but get included in our release. e.g, #2160
Issue #, if available
-
Many of our React related dependencies require a higher React version(>16.9), like testing library. It would be a pain for our library to continue with 16.8
-
Plus, React 16.8 does not support the new JSX transform which generates clean code and ends up reducing the bundle size.
Description of how you validated changes
Testing against a sample app running on React 16.14.0, React 17 and React 18
Checklist
- [x] PR description included
- [x]
yarn testpasses - [x] No side effects or
sideEffectsfield updated
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
🦋 Changeset detected
Latest commit: 199e943e32d21e3e2cb57eebda2369634495c4f1
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @aws-amplify/ui-react | Major |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Should we go ahead and make this change on the branches with ui-react-core as well?
Should we go ahead and make this change on the branches with ui-react-core as well?
That's a valid callout, needs to be done on the in-app-messaging/main branch.
@zchenwei Should we also update the pinned version of @types/react in the root package.json to point at a [email protected] compatible version as well?
Should we go ahead and make this change on the branches with ui-react-core as well?
That's a valid callout, needs to be done on the
in-app-messaging/mainbranch.@zchenwei Should we also update the pinned version of
@types/reactin the root package.json to point at a[email protected]compatible version as well?
That's a good callout. I am actually going back and forth with it. One the one hand, the tricky thing is there is no one to one match relationship between types/react and react. types/react is released more frequently than react, so literally we have no idea which version of types/react we should target to pin for [email protected]. On the other hand, [email protected] is the last release of react 16, so I think no new types will be release into types/react@^16.14.0 other than bug fixes or improvement, which still benefit us. Or we can make it to only allow patch versions - types/react@~16.14.0 if that makes us feel more comfortable and safe. Thoughts?
Off the topic - For a library, sometimes I feel like @types/xxx should be direct dependencies or peer dependencies because user may install random version of them and ends up running into type errors.
LGTM! Will this fix the duplicate hooks issues we see building projects in stackblitz?
What was that duplicate hooks issues?
Looks good, we just need to update the migration guide to callout the new minimum React version.
Will do once I get the next-release/main branch into mine
After discussion with @reesscot offline, we think it is risky to get this out because we do not fully understand how @types/react@16 will affect users with apps running on a higher react version. It is not worth it taking the risk of making such changes that nobody complains about now