Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Apply Stateful Computations To Functions


    When building our stateful computations, there will come a time when we’ll need to combine two or more state transactions at the same time to come up with a new result. Usually this occurs when want to use plain ol’ JavaScript functions with two or more a arguments as part of our stateful computations.

    We first look at how this can be accomplished by using chain and closure to get access to both functions. Then we will explore how we can leverage the of construction helper and the ap State instance method to clean this type of interaction up a bit. We then conclude with an even cleaner approach that takes full advantage of a crocks helper function named liftA2.