Understanding Hooks Part 4 — Hook

What’s behind the legendary Hooks? From time to time, I wonder.

Starting Part 2 and Part 3, useEffect and useState are detailed examined on all usages. In this Part 4 we’d like to reveal the generic feature of a Hook.

Given a Hook and a unique id, for the first time it can be initialized via constructor. For each element update, the hook invokes update with the args.