I have to create the styles based on a param, for that i have done as below.
const useStyles = (isLayoutReadOnly = false) =>
makeStyles((theme: Theme) => {
return {
x: {
margin: theme.spacing(0, 0, 1, 0),
marginLeft: !isLayoutReadOnly ? '-20px' : undefined
}
}
};
});
And i am trying to use it this way,
const { x } = useStyles(isLayoutReadOnly);
Which throws me the error
property x does not exist on type '(props?: any) => ClassNameMap<"x">'
How should i fix this issue? I have tried setting the custom return types and also ReturnType<typeof makeStyles>
, how ever, it is unable to detect.