Set The Type For A useState Hook
const [open, setOpen] = React.useState(false);const [error, setError] = React.useState(null);
setError('There was an error');
// Argument of type 'string' is not assignable
// to parameter of type 'SetStateAction<null>'const [error, setError] =
React.useState<null | string>(null);Last updated