3 ms·
I'm with you on the embedded HTML in JavaScript files. There's a reason everyone went nuts for MVC, the seperation of UI code (in my opinion) just makes your li
by zilchers 10y ago
I'm with you on the embedded HTML in JavaScript files. There's a reason everyone went nuts for MVC, the seperation of UI code (in my opinion) just makes your life as a developer easier.
- TheCoelacanth 10y agoThere is still a separation of UI code, though. React components are just your view layer.
- thibauts 10y agoWe're past static view components. Today UI elements are dynamic things and the code that drives the dynamics should be kept close to the static representation of a given view state. React actually separates UI code and interaction logic, as it should, by hosting the static part in the render function and the dynamic part in event handlers defined on the component. This is in my opinion a great balance of SoC / cohesion as it allows proper scoping of a UI unit and fosters controlled reuse. I don't want to sound rude but we've had enough of this MVC fanatism that completely disabled many developer's creativity and took a lot of courage and energy to the React team, among others, to challenge. Tying view logic (and only view logic) to static UI code is probably the only way to go on the path to proper UI component sharing and reuse. Whether we like it or not, whether we put the code in separate files or use any other artifice we're bound to make these two walk hand in hand. The last bastion being style. Which the React community tried to address, too. At the risk of saying something obvious, I think we shouldn't reason on principles and habits. Progress can't be, and never is, driven by such forces.