@
[email protected] the entire dom is basically an event system. the entire javascript language is one big event loop :D
in a nutshell: in react functions are called every time the component is "rendered". and the returned jsx is then diffed (aka vdom diffing) and the difference is then applied to the actual dom.
and hooks allow you to "hook" into that process and persist data between renders or do something on (un)mount or when data changes.