I am getting this error:
No overload matches this call.
How to resolve this error?
I am trying to create custom button. I am able to create button but getting above error.
import * as React from "react";
import Button, { ButtonProps } from "@mui/material/Button";
import { styled, Theme } from "@mui/material/styles";
interface DPWButtonProps extends ButtonProps {
"dpw-variant": string;
}
const getStyles = (type: string, theme: Theme) => {
const commonStyle: object = {};
const themeStyles = {
primary: {
...commonStyle,
background: `red`
},
default: commonStyle
};
return themeStyles[type as keyof typeof themeStyles] || themeStyles.default;
};
const DWButton = styled(Button)<DPWButtonProps>(
({ "dw-variant": variant, theme }) => {
return getStyles(variant, theme);
}
);
export default DWButton;
I am using it like this:
<DWButton dw-variant="primary">nnn</DWButton>