September 2017
Intermediate to advanced
216 pages
6h 8m
English
When you use maps as the means to declare your application logic, it's helpful to think of the map keys as the possible paths. For example, an if statement checks whether a condition is true, and if so, it allows for a block of code to be executed. With maps, keys are the condition. The values with which they're paired represent the functionality to execute when the condition is true.
Let's illustrate this idea at it's most basic level using an Immutable.js map:
const actions = Map.of( 'first', () => console.log('first'), 'second', () => console.log('second'), 'third', () => console.log('third'));actions.get('second')();// -> secondactions.get('third')();// -> third
The actions map represents the ...
Read now
Unlock full access