小编Rua*_*rte的帖子

lodash 两个对象数组的差异

useEffect我的reactJS中有以下代码

\n
const A1 = [{id: 1, nome: "Ruan"}, {id: 2, nome: "Gleison"}]\nconst A2 = [{id: 2, nome: "Gleison"}, {id: 3, nome: "Geraldo"}]\n\nconst results = _.xor(A1,\xc2\xa0A2);\n\nconsole.log(results)\n
Run Code Online (Sandbox Code Playgroud)\n

lodashis的逻辑_.xor是返回两个数组之间的差异,但是,事实并非如此

\n

我得到的回报如下

\n
0: Object {id: 1, nome: "Ruan"}\n1: Object {id: 2, nome: "Gleison"}\n2: Object {id: 2, nome: "Gleison"}\n3: Object {id: 3, nome: "Geraldo"}\n
Run Code Online (Sandbox Code Playgroud)\n

我感谢所有提供帮助的努力

\n

javascript lodash react-hooks

2
推荐指数
1
解决办法
3010
查看次数

标签 统计

javascript ×1

lodash ×1

react-hooks ×1