← Back to context

Comment by ourcat

4 years ago

This is exactly why I prefer Angular to React.

Our designer wouldn't have been able to deal with HTML markup within the JS files in React. Having the HTML and (S)CSS separated out made life much easier for him in Angular.

(edit: Naturally downvoted due to being slightly critical of React on HN. Which happens every time.)

I'm not sure you are being critical of React. There is nothing about React that prevents you from separating the HTML and CSS into separate files.

You are being critical of separation choices. To which I am curious why embedding the CSS and HTML inside a Javascript file makes any difference to the designer? In practice, we often see slightly different syntax to accommodate, but I cannot imagine that is a true barrier. The CSS and HTML (or their slightly modified equivalents) are still logically separated from the rest of the logic in the file.

  • I build all the components and get them working with mostly 'vanilla' styling. Then he brands/styles any he needs to by simply editing the .html and .scss files.

    He has no idea about how the TypeScript/JavaScript files work. He doesn't really have to touch them, unless to maybe see what extra data the component model contains if he wanted to dig deeper and display other things.

    • Does he need to know how the Javascript files work, though? The HTML/CSS parts are still logically separated from the rest of the code. I am not sure someone who is capable of working on that type of content would struggle to recognize them. As long as the team is consistent, you can even reasonably predict exactly where such content would be found in the file.

      If the designer was handed an HTML page with <style> tags embedded, I cannot imagine he would fall down unable to figure out where the CSS is, and this is not much different.