install material ui typescript 1

install material ui typescript

// Installation
npm install @material-ui/core
// or
yarn add @material-ui/core

// In order for types to work, you have to at least have the following options enabled in your tsconfig.json:
{
  "compilerOptions": {
    "lib": ["es6", "dom"],
    "noImplicitAny": true,
    "noImplicitThis": true,
    "strictNullChecks": true
  }
}

Here is what the above code is Doing:
1. Importing the Button component from @material-ui/core/Button.
2. Importing withStyles and makeStyles from @material-ui/core/styles.
3. Defining a styles object with a rule for the button color.
4. Creating a useStyles function that returns the styles object.
5. Using the useStyles function to get the classes property.
6. Using the classes property to apply the styles to the button.

Similar Posts