~/talk

Code crimes for good component APIs

Talkat JSHeroes 2022 · on Thursday, 2022-06-09· [react]
slides:none on file

Claims a few deliberate hacks make component APIs far easier to use: uses React, SSR and hydration details, and builds a SelectionMenu and NavList that manage state for consumers. Implements child kidnapping by inspecting React children and cloning anchors, uses context fallback, falls back to an isomorphic id plus document.querySelector, and injects a small inline script via dangerouslySetInnerHTML to set defaults before hydration. Works in a closed design system but breaks for general public libs.

AI-written summary · about

  1. 0:00Introduction
  2. 0:48Code vs UI double standards
  3. 3:13Anchored overlay API problems
  4. 4:59Selection menu component intro
  5. 6:26Child kidnapping for SSR
  6. 7:49SSR lag issue
  7. 8:35Solving SSR with child kidnapping
  8. 12:06Nav list component improvements
  9. 14:10Nav group default open challenge
  10. 16:18Context-based nav state
  11. 17:44SSR issues with context
  12. 18:49Handling Next.js Link and aria-current
  13. 19:51Isomorphic ID and DOM queries
  14. 21:15Inline script for faster hydration
  15. 23:25Conclusion
~/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.