I am working on React app with Material-UI.
Is there any way to use media query or determine viewport width in React/Material-UI way outside a component body?
I need to set default props for a component based on viewport size.
For now, I am handling it with windows.innerWidth as below.
const defaultProps = {
textVariant: window.innerWidth < 600 ? 'body1' : 'h4',
}
const Text = (props) => {
...
}
Text.defaultProps = defaultProps;
Is there any Material-UI utility that can be used in setting default props based on viewport size?