Immutable JS compare nested structures

前端 未结 3 1565
南旧
南旧 2021-01-04 07:39

I have 2 nested structures newState and newState1.

But when I compare their, equals() or Immutable.is() returned false

3条回答
  •  醉梦人生
    2021-01-04 07:59

    What about using JSON.stringify?

    JSON.stringify(values) !== JSON.stringify(anothervalue);
    

    If you know they are not circular objects, and do not contain functions, I think it's the fastest way to compare them.

提交回复
热议问题