Summary

In this chapter, we looked at sequences and lazy evaluation, as these concepts are central to Immutable.js. Lazy evaluation is especially important in scenarios where you have large collections, and having to process every value could result in performance issues.

Side-effects are how you initiate lazy evaluation of sequences. You can manually iterate over them, or you can use the forEach() method. Filtering sequences is also done lazily, even chaining together multiple filters. Since the lazy aspect of sequences is handled internally by Immutable.js, you can focus on readable method call chains.

Also, it's important for your side-effects to ask for a limited number of values from sequences, using slice() or take(), so that you can maximize the benefit of lazy evaluation.

In the next chapter, we'll look at sorting your collections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.32.86