Questions
3.1 Uninitialized object? React-Redux programmers usually code action creators to simplify the creation of actions that will later be processed by a reducer. (We saw this in the A React-Redux reducer section.) Actions are objects with a type
attribute, used to determine what kind of action you are creating. The following code supposedly produces an action, but can you explain the unexpected results?
const simpleAction = (t:string) => { type: t; }; console.log(simpleAction("INITIALIZE")); // undefined
3.2 Are arrows allowed? Would everything be the same if you defined useArguments()
and useArguments2()
from the Working with arguments section by using arrow functions instead of the way we did, with the function
keyword?
3.3 Three more types: Back in the One argument or many? section, we showed the types of sum3()
and altsum3()
, but we didn’t do that for fn1
, fn2
, and fn3
. What are the types of those functions?
3.4 One-liner: A programmer...