I want to show a list of user uids and some information about them, except for the information of a specific user.(我想显示用户uid的列表以及有关它们的一些信息,但特定用户的信息除外。)
Here is an example of my JavaScript object, which I am storing in as a usersData
state:(这是我的JavaScript对象的示例,我将其存储为usersData
状态:)
{
"alkfklnj2340": {
"uid": "alkfklnj2340",
"username": "username1"
},
"235o2hifoiid": {
"uid": "235o2hifoiid",
"username": "username2"
}
}
For example, I want to return a new object without alkfklnj2340
, so:(例如,我想返回一个没有alkfklnj2340
的新对象,因此:)
{
"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
);
ask by Robert Berge translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…