Hacker News new | ask | show | jobs
by antris 4055 days ago
> But there's something to be said for having a single template file for a single page in Angular, versus having JSX scattered among 20+ components for that same single page in React

I'm not sure what you mean. There's nothing in React that would prevent you from making your pages just one huge component. You can split the code any way you like.

1 comments

That's true. But React is generally associated with the Flux architecture pattern, which emphasizes small, modular, mostly stateless components.
There is a reason for that and it is because it makes for simpler code. Simpler code is easier to test and simple tested code should have less bugs. Also you get the advantage of reusability from all of the small components you build. If you don't want to follow the recommended programming practices, you don't have to but I would like to encurrage you to adopt them because they really are helpful.
I want to +1 the "makes for simpler code." I'm working on a side project in my free time on nights and weekends. I find the simplicity of React makes it very easy to jump back in after not working on it for a week, or when coding while I'm tired. Working with simple components allows me to constantly move forward, even if it's only for 30 minutes or an hour a night