I want to show a list of user uids and some information about them, except for the information of a specific user.
Here is an example of my JavaScript object, which I am storing in as a usersData state:
{
"alkfklnj2340": {
"uid": "alkfklnj2340",
"username": "username1"
},
"235o2hifoiid": {
"uid": "235o2hifoiid",
"username": "username2"
}
}
For example, I want to return a new object without alkfklnj2340, so:
{
"235o2hifoiid": {
"uid": "235o2hifoiid",
"username": "username2"
}
}
I have tred this so far, which doesn't quite output what is expected:
const filteredUsers = Object.keys(this.state.usersData).filter((key, i) =>
this.state.usersData[key].uid != this.state.userUid
);