Hook
↔ Specialized Function Functionally extends FC with Lifecycle Method & persistent state
aka Hooks
Specialized Function to "hook" into core React functionality
State Scope
declare [<span data-tooltip-id="preview__9Le7zdA2R4LzoE852">FC</span>](fc) with hooks
React 18
comes with 15 built-in hooks consisting of Stateful Hook, Effect Hook, Memoizing Hook & Library Hook
References
FC
↔ function to return UI via JSX. Passprops
for dynamic input. add state via HookPurity
↔ Hooks allow easier debug Side EffectTestability
↔ Hooks split off functionality to Unit Test easieruseEffect()
↔ Hook to run Effect in FC at specific stage of Component Lifecycle, set by Deps ArrayuseLayoutEffect()
↔ Hook variant ofuseEffect()
, to call Effect as soon as DOM API generated BEFORE UI repaints to DOM APIStateful Hook
↔ (typeof) Hook to add state to FCEffect Hook
↔ (typeof) Hook to run Effect inside Component at different stages of Component LifecycleMemoizing Hook
↔ (typeof) Hook to Memoize for better perf by avoid repeat calculationsLibrary Hook
↔ (typeof) advanced Hook for use in larger component libraries & modulesDeps Array
↔ Deps[] to pass as last arg to Trigger HookDependency
↔ any Variable local to FC Scope to control Hook TriggerCustom Hook
↔ user defined Hook to consume Library Hook & reuse stateful logic