[*]styles.js
< /ol>
Код: Выделить всё
import { makeStyles } from '@mui/styles';
import { red, green } from '@mui/material/colors';
export default makeStyles((theme) => ({
avatarExpense: {
color: theme.palette.getContrastText(red[500]),
backgroundColor: red[500],
}
}));
< /code>
Я создаю объект в моем list.jsx < /strong> с использованием < /li>
< /ol>
import React from 'react'
import styles from './styles';
const List = () => {
const classes = styles();
return (
)}
< /code>
Я получаю ошибку: < /p>
styles.js:13 Uncaught TypeError: Cannot read properties of undefined (reading 'getContrastText')
< /code>
Мое расследование предполагает, что это связано с чем-то, связанным с темой по умолчанию ... не уверен ...
Я попробовал исправление «CreateTheme», но я не могу импортировать.import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
);
Подробнее здесь: https://stackoverflow.com/questions/794 ... rial-ui-v6
Мобильная версия