I am getting this error whenrunning on expo. The uid is in firebase.
2
You are probably trying to access the property "uid" of the object user before it is set.
The error says exactly that, that you are trying to get the property uid of a null object.
Make sure the object is set before you try to access it
You could not access uid because the value of the user is null. You should use user?.uid for the null safe operator. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
uid
null
user?.uid
Click here to cancel reply.
2
Answers
You are probably trying to access the property "uid" of the object user before it is set.
The error says exactly that, that you are trying to get the property uid of a null object.
Make sure the object is set before you try to access it
You could not access
uid
because the value of the user isnull
.You should use
user?.uid
for the null safe operator.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining