Skip to content

Instantly share code, notes, and snippets.

@et
Last active November 1, 2017 00:25
Show Gist options
  • Save et/efa84ff9891d241c914d80bdb951604c to your computer and use it in GitHub Desktop.
Save et/efa84ff9891d241c914d80bdb951604c to your computer and use it in GitHub Desktop.
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