getting a problem while using makestyles and creating a const variable in app.js or styles.js

Viewed 19

I am currently learning material UI and the problem is

import { makeStyles } from '@mui/material/styles';

const useStyles = makeStyles({
  root: {
    background: 'linear-gradient(45deg, #333, #999)',
    border: 0,
    borderRadius: 15,
    color: 'white',
    padding: '0 30px'
  }
})

I am in the process of creating a button and giving them styles. whenever I create this const variable everything on the page vanishes, and when I delete them everything gets restored. Is there any solution to this problem?

1 Answers

You need to install it:

npm install @mui/styles

Then import it with:

import { makeStyles } from '@mui/styles'

Related