Bumb react from 16.8 to react 17

The command in the bottom for @mui/material needs React version 17 and as far as i can tell DHIS app plattform uses 16.8. Can one simply bump it up in the package.json in the d2/shell folder: Like the picture suggests, or would that not work.

For the purpose of installing a stepper from Material UI on the DHIS app plattform.

Ive used the commands:
yarn add @mui/material @emotion/react @emotion/styled

From

Whenever i try to use the stepper from material UI it gives me this error:

Compiled with problems:
×
ERROR in …/…/…/…/…/…/node_modules/@emotion/react/dist/emotion-element-7a1343fa.browser.development.esm.js 1:0-31
Module not found: Error: Can’t resolve ‘react’ in ‘C:\Users\MYNAME\node_modules@emotion\react\dist’

… and many more errors like the one above.

Any help here would be greatly appreciated!

1 Like

Hello @H.K

Welcome to the community!

I believe the official support for React > 16.8 will be available with a stable version of v12.0.0 of the app runtime(This is still in alpha). See this release.

The best option is to revert to the @mui/* and @emotion/* versions that worked with React 16.8.

You could also try the alpha version of the @dhis2/cli-app-scripts but it is not recommended for production (See the alpha releases here).

2 Likes

Hi @H.K and thanks @nnkogift.

Gift is indeed correct in both the assumption and the recommendation, we will be upgrading the App Platform to support React 18 which will also migrate Create React App to Vite.

We would then also recommend not using React 17, but going straight to React 18 when you’re using the new app platform version, however as it is still in Alpha your best bet is to downgrade the packages as Gift suggested

1 Like