re: Anyone else intolerant of html inside javascript? yes i mean React VIEW POST


I prefer using templates as well. I like to treat views/templates as a more basic entity where you need an occasional if-statement or loop to output data. Any more complex logic has its own dedicated place. Having the power of JavaScript inside the HTML template sounds beneficial but I could see the code becoming hard to manage if there is a mess of JS, CSS, and HTML in the JSX. An example is this component from the React documentation: github.com/reactjs/reactjs.org/blo... I think that file would be so much easier to read through and work in if it was separated into <style>, <script>, and <template>. I'm not a Vue or Svelte user, but that style of writing components looks more appealing to me.

Looking at some React code reminds me of my experience with legacy PHP and ColdFusion scripts that were mixed with HTML, CSS, and JS. Those old legacy applications were very difficult to update because everything was intertwined and tightly coupled. You couldn't easily refactor, restructure the page, or re-style it because everything was scattered throughout the file.


Ugh. That looks like a nightmare. Where is this in the docs?

code of conduct - report abuse