used firebase for authentication
error is:
Argument of type 'object | undefined' is not assignable to parameter of type 'SetStateAction<string>'.Type 'undefined' is not assignable to type 'SetStateAction<string>'
const [User, setUser] = useState(false);
const [UserData, setUserData] = useState("");
const signin=async()=>{
setProgress(10)
const UserInfo=await signInWithGoogle(); // UserInfo is a json object
setUser(true)
setUserData(UserInfo) //error here......
console.log(UserData);
setProgress(100)
}
const signout=async()=>{
console.log("sign out");
setProgress(30)
alert("Press OK to Log Out")
signOutWithGoogle()
setProgress(70)
setUser(false)
// User?alert("signed out successfully"):""
setProgress(100)
}```
.................................
New contributor
Divyansh Bhardwaj is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.