Material UI {makeStyles} PLease help

Hello, campers! I’m using Material UI to build a calculator. This is my first effort at using Material UI in a project. I’m having trouble with Material UI’s makeStyles function. To develop my project, I’m using Visual Studio Code. When I import {makeStyles}, I have a problem…

When I install npm install @mui/styles
It throws an error…

These are the dependencies that are installed.

Please guide. What should I do? Is there any additional dependency that must be installed?

Please help…

It’s not working with react 18, the version of Material UI you’re using has the requirement for React 17 pinned, so either downgrade React to React 17 (ie install that version) or use a newer version of Material UI

@DanCouper There is another problem that arises.

import {makeStyles} from '@mui/styles';
import classNames from ''classnames';

const useStyles=() => makeStyles({
    backgroundColor: 'voilet',
    fontSize: '3rem'

function App() {
const classes = useStyles();

return (
            //style={{backgroundColor: 'red' }} 

export default App;

Please check my code and what is wrong with it. CSS is not working on the button. Please guide. For the past two days, I’ve been stuck here.

You’ve got a syntax errors (which should be highlighted in your editor)

import classNames from ''classnames';

Will break all the code after it because you’ve got two quotation marks before classnames, needs to be

import classNames from 'classnames';

@DanCouper {makeStyles} The net ninja is this video code is fine to follow…
I think this tutorial is using a downgrade version of Material UI. I’m unable to find any tutorial for the latest version of Material UI. I’m reading docs but I’m unable to find some help for applying a custom classes to my buttons…

Please help…
Accept my apologies for disturbing you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.