Answer a question

As the title says. Both accept same kind of ThemeOptions object.

const theme = createMuiTheme({
  palette: {
    primary: {
      main: "#006400"
    },
    secondary: {
      main: "#ffa500"
    }
  }
});
const theme = createTheme({
  palette: {
    primary: {
      main: "#006400"
    },
    secondary: {
      main: "#ffa500"
    }
  }
});

Is createMuiTheme() only for applying styles to Mui components, and not my custom components?

If I want to create custom CSS classes, should I use makeStyles() instead?

Answers

createTheme is the newer name, createMuiTheme is deprecated https://github.com/elyra-ai/elyra/pull/1885. You are correct createTheme() is used to apply different default styles to the Mui components

makeStyles() is a good way to make custom css classes for your new components or the Mui components.

Logo

React社区为您提供最前沿的新闻资讯和知识内容

更多推荐