Answer the question
In order to leave comments, you need to log in
Type 'string' is not assignable to type '"" | «success» | warning | "error"?
Component:
interface AlertProps {
variant: "success" | "warning" | "error" | "";
}
const Alert = ({ variant }: AlertProps) => {}
const [alertvariant, setAlertvariant] = useState("success");
return (
<Alert variant={alertvariant} />
)
Answer the question
In order to leave comments, you need to log in
const [alertvariant, setAlertvariant] = useState<AlertProps["variant"]>("success");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question