[*]styles.js
< /ol>
Code: Select all
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>
Ich erstelle ein Objekt in meiner list.jsx < /strong> mit < /li>
< /ol>
import React from 'react'
import styles from './styles';
const List = () => {
const classes = styles();
return (
)}
< /code>
Ich erhalte einen Fehler: < /p>
styles.js:13 Uncaught TypeError: Cannot read properties of undefined (reading 'getContrastText')
< /code>
Meine Untersuchung deutet darauf hin, dass es mit etwas mit dem Standardthema zu tun hat ... nicht sicher ...
Ich habe das CreateTheThe-Fix ausprobiert, aber ich kann es nicht importieren.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(
);