react-intl migration from v2 to v4
- Migrating the peerDependency react-intl from v2 to v4 is a breaking change that requires some small but crucial changes. In short, we lose the
intlShapeprop-type and have to do some busy work to accommodate that, but we gain the
useIntlhook. It feels like a win! (STRIPES-672)
package.json, update the
intlShapeprop-type is no longer available; replace it with
PropTypes.objectand remove the import.
- Translation values with attributes in translations are no longer supported. See this ui-developer PR for an example of replacing a link with a translation using
react-intl-safe-htmlwith one using straight up
react-intl. You may still use
react-intl-safe-htmlfor cases of
b, i, em, strong, span, and
- React's legacy context API is no longer supported; if you were using it, use
- The following shell commands should take care of most prop-types changes:
find ./src -type f -name \*js | xargs perl -pi -e 's/intl: intlShape.isRequired/intl: PropTypes.object/g'
find ./src -type f -name \*js | xargs perl -pi -e 's/intl: intlShape/intl: PropTypes.object/g'
find ./src -type f -name \*js | xargs perl -pi -e 's/ intlShape,\n//g'
moment will become a peerDependency
momentto a peerDependency makes certain that the same instance, configured by stripes with the current locale, is available to all modules. (STRIPES-635)
package.jsonfile. That's it!