Reputation: 40924
How can I check if two JavaScript values are the same?
If they are objects, I would like to compare them key-by-key recursively.
I'm looking for an existing function, not a way to write my own like described in this question: Object comparison in JavaScript.
Upvotes: 3
Views: 4470
Reputation: 826
In react native >= 0.62.2 use,
import deepDiffer from `react-native/libraries/utilities/differ/deepDiffer`
deepDiffer(obj1, obj2) // true or false
Upvotes: 2
Reputation: 4770
Took a bit of Googling to find how to import deepDiffer
.
import deepDiffer from 'react-native/lib/deepDiffer'
...
deepDiffer(obj1, obj2) // true or false
Upvotes: 2