Created
May 22, 2020 18:34
-
-
Save Jon20111/6b7d1bf64e3dbdcdb7d818ebc0bf1d04 to your computer and use it in GitHub Desktop.
A demonstration of how to override the default Material UI component style using useStyles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC, useMemo } from 'react'; | |
import { TextField, withStyles } from '@material-ui/core'; | |
import { useStyles } from './form.styles'; | |
export const Form: FC = () => { | |
const classes = useStyles(); | |
const StyledTextField = useMemo( | |
() => { | |
return withStyles({ | |
root: { | |
margin: 8 | |
} | |
})(TextField); | |
}, [] | |
); | |
return <form> | |
<StyledTextField variant='outlined' label='Text Field 1' /> | |
<StyledTextField variant='outlined' label='Text Field 2' /> | |
</form> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment