Hacker News new | ask | show | jobs
by ForHackernews 861 days ago
No accounting for taste, I suppose. Writing JSX is a nightmare to me. It's like we've forgotten 20 years worth of hard-earned knowledge about the value of separation of concerns.
6 comments

What is the value of separation of concerns when it comes to UI? Because I find not colocating the logic and styling for a component to be very annoying when it comes to looking for the right files.
The component DIR should have css, logic/js and template/markup. Seperation of concerns right down to component level. It really comes down to how organised the devs and their tools are.
Or you could put all that stuff in a single-file component or use JSX with atomic CSS or CSS in JS.
Do a 5 why for separation of concern and you'll find JSX is more logical.

You want things edited together to be closer in code also. A single file or couple of files next to each other that decide structure, behaviour and view of a component is better than few CSS/JS for whole site.

if that's what you thought separation of concerns meant it's best to forget it
JSX is an anti-pattern IMO. People just don’t wana see it as such.
I agree with you about separation of concerns, but I don't think JSX is the guilty party there, so much as the overarching frontend ethos that pushes the idea of "single file components" to extremes.
> It's like we've forgotten 20 years worth of hard-earned knowledge about the value of separation of concerns.

No. We haven't. Because there's a different separation of concerns: https://twitter.com/simonswiss/status/1664736786671869952