• Title: Getting Closure on Hooks
  • Topic: React
  • Venues: Reactathon
  • Date: Mar 2019
  • Article: https://www.netlify.com/blog/2019/03/11/deep-dive-how-do-react-hooks-really-work/
  • Tweet: https://twitter.com/swyx/status/1100809424963219456
  • Desc: Cloning the React Hooks API in raw JS
  • Description: The design of React Hooks requires a good understanding of closures in JavaScript. In this talk, we’ll reintroduce closures by building a tiny clone of React! This will serve two purposes – to demonstrate the effective use of closures, and to show how you can build a Hooks clone in just 29 lines of readable JS. Finally, we arrive at how you get Custom Hooks and the Rules of Hooks out of this incredible mental model!