Reputation: 5338
I want to import a Mui theme color to pass its value to a component. How can I import the color?
const WonderChart = () => {
return (
<WonderChart lineColor={theme.palette.primary.main} />
)
}
Upvotes: 0
Views: 834
Reputation: 3772
useTheme
hook can be used for this.
Documentation
import { useTheme } from '@material-ui/core/styles';
const WonderChart = () => {
const theme = useTheme()
return (
<WonderChart lineColor={theme.palette.primary.main} />
)
}
Upvotes: 1