2 ms·
Should we use Immutable.is instead of == in shouldComponentUpdate() ?
by scotty79 11y ago
Should 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.