typescript optional props with default value code example
Example: react typescript optional props
type HeaderProps = {
title?: string
};
const Header: FC<HeaderProps> = ({ title = 'Default Title' }) => {
return (
<img src="https://i.pinimg.com/originals/e5/4c/b4/e54cb468c3cf376d1b75014e7186236a.jpg" />
);
}