score:10

Accepted answer

checking the documents of material-ui it turns out you have imported some of the things from library in a wrong way. like the docs state -

import { usetheme } from '@material-ui/core/styles';
import { createmuitheme } from '@material-ui/core/styles';

which can basically be

import { usetheme, createmuitheme } from '@material-ui/core/styles';

same goes for themeprovider

import { themeprovider } from '@material-ui/core/styles';

score:6

in mui v5 you need to import themeprovider and createtheme from @mui/material/styles instead of @mui/styles.

import * as react from 'react';
import reactdom from 'react-dom';
import {red} from '@mui/material/colors';
import { themeprovider, createtheme } from '@mui/material/styles';

const theme = createtheme({
  palette: {
    primary: {
      main: red[500],
    },
  },
});

function app() {
  return <themeprovider theme={theme}>...</themeprovider>;
}

reactdom.render(<app />, document.queryselector('#app'));

source


Related Query

More Query from same tag