I'm new to React Native, I was trying to use the template literals for my firebase update, but somehow it doesn't work. Did I used in a wrong way? here is my code:
export default function updatefriends(FriendsUID){
const friendadd = async() =>{
const Uid = firebase.auth().currentUser.uid
const friendlist = firebase.firestore().collection('users').where(
"UID", "==", firebase.auth().currentUser.uid).get();
console.log(Uid)
friendlist.then((querySnapshot) =>
{querySnapshot.forEach((doc) => {doc.ref.update(
{'FriendsList.${FriendsUID}':true})
})
})
}
This line having issue:
{'FriendsList.${FriendsUID}':true})
When I push the update, it added "${FriendsUID}" into my database, instead of the actual text.