Post
React uses an internal "Fiber" data structure, one per every component instance. Those store the current props, state, and hooks. All components (class, function) are facades over the Fiber data, and all forms of state queue the same rendering mechanism: blog.isquaredsoftware.com/2020/05/blog...
blog.isquaredsoftware.comBlogged Answers: A (Mostly) Complete Guide to React Rendering BehaviorDetails on how React rendering behaves, and how use of Context and React-Redux affect rendering
React knows which component instance it's rendering based on the current Fiber instance. That gets saved as a module-scoped variable in the hooks impl file, and the hook functions iterate through the list of hooks in a field on that Fiber. See @swyx.io 's "build hooks" talk: www.swyx.io/hooks
swyx.ioGetting Closure on React HooksLearn React Hooks by building a clone of React - in 30 minutes!
1 repost7 likes
No replies yet.