3 ms·
`<button onclick="this.classList.add('bg-green')">` Encouraged? Huh? We spent YEARS splitting logic from presentation and not describing presentation with visu
by oliyoung 3y ago
`<button onclick="this.classList.add('bg-green')">`
Encouraged? Huh? We spent YEARS splitting logic from presentation and not describing presentation with visual characteristics.
This is a terrible idea.
- deleted 3y ago[deleted]
- TheMajor 3y agoI just can't bring myself to like or be encouraged to use any form of approach that binds together logic and presentation. It looks and smells like terrible programming. Separation of concerns matters and, as you mentioned, more seasoned devs had decades of this being drilled into us.
- jaza 3y agoAmen. Everything else in this article I can stomach. But onclick - just say no.
- _heimdall 3y agoThis is actually the most interesting one to me, not because I prefer it but because I want to see what others think. I've been told by quite a few Tailwind users that they much prefer it because it bring styling and markup into the same place. In their view markup and styling are so linked that splitting the code up is painful to follow and maintain. This onclick example follows the exact same argument, that the click handler is so tied to the markup that it should be inline.