~/talk

useEncapsulation: Using React Hooks Sensibly

Talkat CascadiaJS 2021 · 2021-11-03..11-04· [react, frontend-architecture]
slides:none on file

Builds an HTML encoder that adds hide/reveal and a 5s countdown, then refactors it by moving related state, handlers, effects into small custom hooks so the component shrinks and behaviors live where they belong. Demonstrates concrete hooks like useInput, useToggle and useManageTimer, uses useEffect/useMemo patterns for stable handlers, and shows an eslint rule that flags direct hook use in components. Result: fewer lines, clearer intent, reusable hooks, and a working refactor.

AI-written summary · about

  1. 0:00Introduction
  2. 2:19What is useEncapsulation
  3. 3:38The problem
  4. 12:28What is encapsulation
  5. 23:36Conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.