user13841165
user13841165

Reputation:

index.js:1 MUI: The `styles` argument provided is invalid. You need to provide a function generating the styles or a styles object

I'm currently building a React 18 app with MUI v5. The development server starts normally and nothing seems to be going wrong except for tens of these errors to be showing up in the logs of the developer console. How can I fix it?

Upvotes: 0

Views: 4114

Answers (1)

Yannick
Yannick

Reputation: 476

I assume you're using @mui/styles, which you shouldn't do. @mui/styles is a deprecated package in MUI v5 and it doesn't work with React 18. You're going to have to either migrate to Emotion or use MUI's @mui/system to handle styling.

https://mui.com/system/basics/

Upvotes: 4

Related Questions