January 2020
Intermediate to advanced
470 pages
11h 13m
English
Both implementations will share basic functionality, so let's start by skipping what lenses are or how they are built and look at some examples of their usage instead. First, let's create a sample object that we will work with: some data about a writer (his name sounds familiar) and his books:
const author = { user: "fkereki", name: { first: "Federico", middle: "", last: "Kereki", }, books: [ {name: "Google Web Toolkit", year: 2010}, {name: "Functional Programming", year: 2017}, {name: "Javascript Cookbook", year: 2018}, ],};
We shall assume that several functions exist; we'll see how they are implemented in upcoming sections. A lens depends on having a getter and a setter for a given attribute, and we can build one by ...
Read now
Unlock full access