2 ms·
The same problem exists for Immutable collections: > Immutable.List.of(1) === Immutable.List.of(1) < false = $3 which is why Immutable.is exists.
by masklinn 11y ago
The same problem exists for Immutable collections:
> Immutable.List.of(1) === Immutable.List.of(1)
< false = $3
which is why Immutable.is exists.
- scotty79 11y agoShould we use Immutable.is instead of == in shouldComponentUpdate() ?
- masklinn 11y agoDepends the semantics you want? `===` is O(1) but it will miss if the collection was altered or replaced in a value-preserving manner, so it will never match if your input is computed (e.g. mapped from a section of the application state). `Immutable.is` is more expensive (since it has to walk both collections) but it will allow skipping updates for equal inputs.