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.

Error while using in latest MUI

See original GitHub issue

I am getting the below error using this library in the latest version on mui.

image

As soon as I add the library and add the below component I get this error.

import React from "react";
import Carousel from "react-material-ui-carousel";
import { Paper, Button } from "@mui/material";

function Example(props) {
  var items = [
    {
      name: "Random Name #1",
      description: "Probably the most random thing you have ever seen!",
    },
    {
      name: "Random Name #2",
      description: "Hello World!",
    },
  ];

  return (
    <Carousel>
      {items.map((item, i) => (
        <Item key={i} item={item} />
      ))}
    </Carousel>
  );
}

function Item(props) {
  return (
    <Paper>
      <h2>{props.item.name}</h2>
      <p>{props.item.description}</p>

      <Button className="CheckButton">Check it out!</Button>
    </Paper>
  );
}

export default Example;

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
n-ii-macommented, May 13, 2022

This package seems to be incompatible with React 18. To fix the problem, add this to your projects package.json file:

"overrides": {
  "react-material-ui-carousel": {
    "react": "^18.0.0",
    "react-dom": "^18.0.0"
  }
}

Be sure to delete your node_modules folder and package-lock.json. Then run npm install to create them again.

1reaction
Learuscommented, May 28, 2022

Since this seems to be a React 18 issue, I will be closing this. The carousel now supports React 18 from version v3.4.0 onwards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - Material UI - MUI
This document covers known issues and common problems encountered when migrating from Material UI v4 to v5.
Read more >
material ui is showing error while installing - Stack Overflow
material-ui uses react versions 16 or 17 as the peer dependencies even if you've react version 18 in your root project.
Read more >
Compile error while trying to install Material UI #32455 - GitHub
After installation of Material-ui - on April 23rd, using the available file on site, I'm can't run my application. I'm using React 18.0....
Read more >
module not found: error: can't resolve '@mui/material/styles'
To fix this error, you must install the package '@mui/material ' before using it. Open the terminal and run the following command to...
Read more >
Error Boundaries - React
In the past, JavaScript errors inside components used to corrupt React's internal state and cause it to emit cryptic errors on next renders....
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