Hacker News new | past | comments | ask | show | jobs | submit login

Yes yes yes! I´ve done some React at my job and also done some Angular/Ionic before. What I never understood of React is why did the creators decided to throw DECADES of Software Engineering development and comingle presentation layer with logic... To separate Views from Logics was an agreed good practice in Software Engineering since I was in undergard school 20 years ago.



I disagree that React is doing anything controversial actually. Angular has logic in it's views, what do you think the handlebars syntax is? The only difference is that they added new syntax to JS instead of adding new syntax to HTML.

And how much logic you put into a component is up to you. Your components can be almost entirely view logic, with any other data fetching or computation offloaded to other regular js files.


That's fair. Why write html in javascript, when you can write shitty javascript in the templates (via ng-if and ng-for)?


Because you will inevitably need to use control flow, conditional rendering, and computed values in your components. And creating proprietary HTML syntax (ie ngIf) to cross reference variables defined in the JS anyways. So why not use JS and gain access to powerful array manipulation, ternary operators, map/reduce/filter functionality, etc instead of leaning on an inferior template syntax?


I actually much prefer how react handles this, I think this very early react talk makes a very good point https://youtu.be/x7cQ3mrcKaY?t=183




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: