React's UseRef Deep Dive
Hooks are the worst thing to ever happen to React. They&#x27;re so easy to get started with but every codebase I&#x27;ve seen adopt them has turned into complete untestable spaghetti.<p>Mixing stateful effectful code inside what would otherwise be a pure declarative render function leads to so much complexity in an attempt to bridge the two paradigms. Junior engineers are also constantly tripped up by the subtleties of `useEffect` and `useState`.<p>Furthermore I think attempting to &quot;encapsulate&quot; side effects is a bad approach to writing testable programs. Most React components that use hooks end up having several chains of promises inside them but no way to await the final promise meaning tests have to be full of<p><pre><code>  await wait(0)
  await wait(0)
  await wait(0)
</code></pre>
God forbid someone comes along and tries to be clever and replaces it with<p><pre><code>  await wait(3)
</code></pre>
which now makes the test non-deterministic.<p>Cycle.js is the only framework that seems to get this right by acknowledging that a component doesn&#x27;t just output JSX, but actually outputs JSX, HTTP Requests, etc.<p>Look, I get that Redux was a pain in the ass with all the boilerplate, but how did we throw the baby (unidirectional data flow) out with the bathwater. I no longer advertise that I know frontend development because the entire react community seems to have lost its mind.