import { List } from 'immutable'; const list = List([1, 2, 3]); const newList = list.push(4); console.log(list.toArray()); // [1, 2, 3] console.log(newList.toArray()); // [1, 2, 3, 4]
import { List } from 'immutable'; const list = List([1, 2, 3]); const newList = list.delete(1); console.log(list.toArray()); // [1, 2, 3] console.log(newList.toArray()); // [1, 3]
import { List } from 'immutable'; const list = List([1, 2, 3]); const newList = list.set(1, 4); console.log(list.toArray()); // [1, 2, 3] console.log(newList.toArray()); // [1, 4, 3]In summary, the immutable List of is a package library for TypeScript that provides efficient and safe manipulation of immutable lists. It helps improve the performance and memory usage of your application by reducing the number of unnecessary copies of data.