So I was making a get user email function and came up with this.
This is the function that works perfectly.
const getMail = (users, userLoggedIn) =>
users?.filter((userToFilter) => userToFilter !== userLoggedIn?.email)[0];
export default getMail;
Here is the 2nd function, that is not working as it's returning undefined
.
const getMail = (users, userLoggedIn) => {
users?.filter((userToFilter) => userToFilter !== userLoggedIn?.email)[0];
}
export default getMail;