So I have a button component which should create a image and a button and tried to pass a prop to src to change the image on each use.
But it throws an error saying:
Type 'string | undefined' is not assignable to type 'string | StaticImport'. Type 'undefined' is not assignable to type 'string | StaticImport'.
Here's my code:
`import { ActionButtonProps } from "@/types";
import Image from "next/image";
const ActionButton = ({
buttonText,
customImageStyle
srcImage,
}: ActionButtonProps) => {
return (
<div className="lg:my-auto">
<button className="flex flex-row py-3 lg:py-0 lg:mx-8">
<Image
src={srcImage}
alt="download icon"
width={25}
height={10}
className={lg:my-auto ${customImageStyle}}
/>
<span className="text-left ml-3 lg:my-auto">{buttonText}</span>
</button>
</div>
);
};
export default ActionButton;`
srcImageis type string in ActionButtonprops
How do I solve this?