I faced few issues once I some components in App from Material UI v4 to v5. One of them is that calling of makeStyles() where class props are rendered based on provided props. In another components where makeStyles() is used without getting props it works properly. Below is the code of the componen:
import { TextField } from '@mui/material';
import { TextFieldBackgroundProps } from '../../textfield/text-field';
import { FC } from 'react';
import { makeStyles } from '@mui/material/styles';
const outlinedPadding = makeStyles({
root: {
'& label.MuiFormLabel-root': {
backgroundColor: (
props: React.PropsWithChildren<TextFieldBackgroundProps>
) => props.backgroundcolor ?? '#ffff',
paddingRight: '5px',
},
},
});
type PropsModelType = TextFieldBackgroundProps;
export const BaseInput: FC<PropsModelType> = (props) => {
const classes = outlinedPadding(props);
return (
<TextField
{...props}
variant="outlined"
inputProps={{
'aria-label':
props.inputProps?.['aria-label'] ?? (props.label as string),
...props.inputProps,
}}
fullWidth
className={classes.root}
/>
);
};
Once I hover over "outlingedPadding" from below code:
const classes = outlinedPadding(props);
TS provides this comment : "const outlinedPadding: never This expression is not callable. Type 'never' has no call signatures.ts(2349)"
As I mentioned before, in Material UI v4 everything works well.
regards