question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support react@18 in @rjsf/material-ui

See original GitHub issue

Prerequisites

What theme are you using?

material-ui

Version

4.2.0

Current Behavior

Unable to install @rjsf/material-ui with react@18

npm ERR! Could not resolve dependency:
npm ERR! peer @types/react@"^16.8.6 || ^17.0.0" from @rjsf/material-ui@4.2.0
npm ERR! node_modules/@rjsf/material-ui
npm ERR!   @rjsf/material-ui@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Expected Behavior

The package @rjsf/material-ui is installed without errors when using react@18.

Steps To Reproduce

No response

Environment

- Node: 18.0.0
- npm: 8.6.0

Anything else?

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:10
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alboo89commented, Jun 20, 2022

@epicfaace I forked the rjsf repo and tried to update the @rsjf/material-ui package to support React 18. The main problem is that mui 4 (used in the @rsjf/material-ui/v4 package) carries with it React 16 || React 17 as peer dependency. If I wanted to open a pull request to allow supporting React 18, what would be the best way to solve this problem?

  1. Discard the support for mui 4 and keep only @rsjf/material-ui package with mui 5 (which allows support for React 18)?

2.Split the @rsjf/material-ui release in 2 separate packages (e.g. @rsjf/material-ui-4 and @rsjf/material-ui with separated source code and package.json) so that the @rsjf/material-ui can work with react 18?

Let me know so that I can proceed 😃

2reactions
alboo89commented, May 25, 2022

I’m unsure if this behaviour is related to React@18, but, if you --force the installation of @rjsf/material-ui, trying to use it results in variations of this error (differing line references and mui element references) repeatedly being logged upon starting the React development server:

WARNING in ./node_modules/@rjsf/material-ui/dist/material-ui.esm.js 1217:24-67
Module not found: Error: Can't resolve '@material-ui/core/Slider' in '<project-dir>/node_modules/@rjsf/material-ui/dist'

If this is due to something irrelevant, I’d be happy to make a new issue.

Using:

├── @mui/material@5.7.0
├── @mui/system@5.7.0
├── react@18.1.0
├── @rjsf/core@4.2.0
└── @rjsf/material-ui@4.2.0

@heath-freenome the --force is not a solution to the problem of not supporting React 18. It would be very useful to have it working on the new version of React, since not every project can downgrade to React 17. @kjkent I’m honestly confused about why we are discussing in this topic about things that don’t concern the main problem of React 18 compatibility 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

5.x Migration - react-jsonschema-form documentation
All PR and branch builds are running against Node 14, 16 and 18. React version¶. RJSF is no longer actively supporting React version...
Read more >
Errors with version 4.0 and material-ui 4 · Issue #2721 - GitHub
In the above scenario, in spite of the warnings/errors, the form displays. But it breaks when I set `tagName="div". `import Form from '@rjsf/ ......
Read more >
@visma/rjsf-material-ui - npm
Material UI theme, fields and widgets for react-jsonschema-form. Latest version: 3.1.0-54, last published: 2 days ago.
Read more >
MUI installation doesn't work with React 18 - Stack Overflow
This is MUI's problem with the new version of react. They are working to release a new version of Material UI. in the...
Read more >
@rjsf/material-ui | Yarn - Package Manager
@rjsf/material-ui. owner rjsf-team233.9kApache-2.05.0.0-beta.15TS vulns 0 vulnerabilities. Material UI 4 theme, fields and widgets for react-jsonschema-form.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found