~/talk

Reusing Stateful Logic in React: HOC vs Render Props vs Hooks

Talkat reactjsday 2019 · on Friday, 2019-10-04· [react, developer-experience]
slides:none on file

Claims that hooks win for reusing stateful React logic after a hands‑on comparison: he implements the same screen‑size feature three ways—higher‑order component, render props and a custom useScreenSize hook—showing HOCs suffer name collisions and static composition, render props create “wrapper hell,” and hooks (useState/useEffect) avoid both and return plain values. Covers five ways to reuse code, cites Redux/Apollo/Formik examples, refactors class components into hooks, and notes the hooks rule about conditional calls and Apollo’s skip option.

AI-written summary · about

  1. 0:00Start
  2. 1:03Why Hooks?
  3. 2:08Reuse Stateless logic
  4. 8:02Reuse stateful logic
  5. 9:24Composition over inheritance
  6. 13:23CLINT EASTWOOD
  7. 13:40Higher Order Function
  8. 19:10HOCs Problems
  9. 24:37Problems?
  10. 33:38Reusing Logic
~/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.