3 ms·
I felt this way when I first saw React and JSX a few years ago. Mixing concerns seemed like a terrible idea that would lead to ruin. And then I tried it, and re
by dceddia 6y ago
I felt this way when I first saw React and JSX a few years ago. Mixing concerns seemed like a terrible idea that would lead to ruin. And then I tried it, and realized it’s wonderful actually - that most of the time, when I changed some HTML, I had to update the corresponding JS anyway, and usually in a separate file (which at the time was jQuery or Angular 1). React put those things in one place, and writing components felt like writing functions.
The worst PHP code I’ve seen is the kind that mixed database queries with presentation, and that was just bonkers. Just a really truly awful mess.
For me, that was the “PHP” I envisioned and what I didn’t want to rehash with React, and I can confidently say that has worked out pretty well.