タグ

2018年8月28日のブックマーク (1件)

  • shallow-equal for Object/React props

    オブジェクトとReactのProps向けのShallow(浅い) equalライブラリを書きました。 Shallow Equalは対象のオブジェクトのプロパティをそれぞれ1段だけ比較することを言います。 ものすごく単純に書くならば次のようなことをするライブラリです。 const object = {}, targetObject = {}; const isEqualed = !Object.keys(object).some(key => { return object[key] !== targetObject[key]; }); const { shallowEqual } = require("shallow-equal-object"); shallowEqual({ a: 1, b: 2 }, { a: 1, b: 2 }); // => true shallowEqual({

    shallow-equal for Object/React props
    takaesu
    takaesu 2018/08/28
    shouldComponentUpdate, recomposeにもshallowEqualあるな