Answers for "argument of type 'null' is not assignable to parameter of type 'setstateaction<string>'."

12

Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'

this.currentUser = JSON.parse(localStorage.getItem('currentUser') || '{}');
Posted by: Guest on December-18-2020
0

argument of type * is not assignable to parameter of type SetStateAction

interface UserData {
  username: string;
  password: string;
  prevState: null
}

const [user, setUser] = useState<UserData | null>(null);
Posted by: Guest on March-29-2022

Code answers related to "argument of type 'null' is not assignable to parameter of type 'setstateaction<string>'."

Code answers related to "TypeScript"

Browse Popular Code Answers by Language