Last active
November 1, 2017 00:25
-
-
Save et/efa84ff9891d241c914d80bdb951604c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { is, fromJS } = require('immutable') | |
const nested = fromJS({ a: { b: { c: [ 3, 4, 5 ] } } }) | |
const nestedWithoutImmutable = nested.setIn(['a', 'b', 'c'], 'foo') | |
const nestedWithImmutable = nested.setIn(['a', 'b', 'c'], fromJS('foo')) | |
console.log("Is it equal? " + is(nestedWithoutImmutable, nestedWithImmutable)); | |
console.log("\nWithout immutable setter\n" + nestedWithoutImmutable); | |
console.log("\nWith immutable setter\n" + nestedWithImmutable) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment