Stripes v4 migration guide
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
intlShape
prop-type and have to do some busy work to accommodate that, but we gain theuseIntl
hook. It feels like a win! (STRIPES-672)- In
package.json
, update thereact-intl
version to^4.5.1
. - The
intlShape
prop-type is no longer available; replace it withPropTypes.object
and 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-html
with one using straight upreact-intl
. You may still usereact-intl-safe-html
for cases ofb, i, em, strong, span
, anddiv
without attributes. - React's legacy context API is no longer supported; if you were using it, use
injectIntl
instead.
- In
- 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
- Migrating
moment
to a peerDependency makes certain that the same instance, configured by stripes with the current locale, is available to all modules. (STRIPES-635)- Move
moment
fromdependencies
topeerDependencies
in yourpackage.json
file. That's it!
- Move