Reputation: 23
I work with ReactJs and Firebase and I get an error message but all the work is apparently fine.
The issue :
export const CreateDbUser = (id, username, email) => {
firebase.database().ref(`users/${id}`).set({
username,
email
})
}
Here I create a database child to store different information about a user (it is just part of the info) and I get this error:
Object(...)(...) is undefined
TypeError: "Object(...)(...) is undefined"
but it all works in the real-time database
I'd like to know why I get this error and how to resolve this because it will probably create a problem in the future. Thank for the help.
Upvotes: 0
Views: 244
Reputation: 499
Unless username
and email
are objects (which I suppose they aren't), you are using set
wrong.
Try this:
export const CreateDbUser = (id, username, email) => {
firebase.database().ref(`users/${id}`).set({
username: username,
email: email
})
}
Upvotes: 1