Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.9K
Views
MaterialUI 5 : TypeError: Cannot read properties of undefined (reading 'create')

After I created ThemeSetting.tsx context I cannot use <Button><Button> and all things that use theme of materialUI ReactJS , Typescript

error

TypeError: Cannot read properties of undefined (reading 'create') push../node_modules/@mui/material/Button/Button.js.Object.ownerState.ownerState node_modules/@mui/material/Button/Button.js:67

  64 | minWidth: 64,
  65 | padding: '6px 16px',
  66 | borderRadius: theme.shape.borderRadius,
> 67 | transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
     | ^  68 |   duration: theme.transitions.duration.short
  69 | }),
  70 | '&:hover': _extends({

and ThemeSetting.tsx

import { createTheme, ThemeProvider } from "@mui/system";

export const ThemeContextProvider: React.FC<{}> = ({ children }) => {
    const theme = createTheme({
        palette: {
            navbar: blue[100],
            tag: {
                red: red[200],
                pink: pink[200],
                purple: purple[200],
                blue: blue[200],
                green: green[200],
            },
        },
        typography: {
            fontFamily: [
                "NotoSans",
                "NotoSansThai",
                "Arial",
                "Roboto",
                "'Helvetica Neue'",
                "sans-serif",
            ].join(","),
        },
        shape: {
            borderRadius: 15,
        },
    });

    return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
};
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Just ran into this myself. You can import createTheme from @mui/material/styles or @mui/system, but they do slightly different things:

You can use the utility coming from the @mui/system package, or if you are using @mui/material, you can import it from @mui/material/styles. The difference is in the default theme that is used (if no theme is available in the React context).

The one from @mui/material/styles is smart enough to fill in gaps in the active theme from the default MUI theme. So if you're using @mui/material, then use @mui/material/styles.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!