Cristian Salcescu
Feb 3 · 1 min read

Take in consideration that books stores a List immutable data structure from Immutable.js. Using push() on books will result in a new List. Any update on the List immutable collection results in a new List.

If books would have stored the JavaScript array data structure ([]), then yes push() would be impure, making the whole function impure.

Cristian Salcescu

Written by

Author of Discover Functional JavaScript and Functional React. Enthusiastic about sharing ideas.