Object.is

The JavaScript function that tells whether two values are the same value, comparing objects by identity.

In more detail

For objects and arrays it checks identity, not contents: two separate objects with equal fields are different. It differs from === only for NaN, which it treats as equal to itself, and for +0 and -0, which it treats as different.

Example

React uses Object.is to decide whether state, props, context values or dependencies changed.

Related terms

Taught in

References