DEV Community

Discussion on: Hydration is Pure Overhead

Collapse
 
starkraving profile image
Mike Ritchie

Back when I used SSR to generate my dynamic markup, I would have a global set of event handlers for scroll, move, click, submit, etc, then use data attributes to declaratively identity what effect i wanted. For example: a href=“somepage.php” data-delegate=“ajax” data-target=“#someexistingcontainer”. That worked really well, because even after loading or replacing content via AJAX i still had the event registered on the body or document. The problem is, I had my code in two places: one for the PHP template for the server-side component, and another for the event handler registration.

One thing I like about CSR is that I can have the template of the component and the event handlers defined all in the same file, which makes it a lot easier to keep track of and maintain. How does Qwik deal with that?