DEV Community

loading...

Discussion on: The best way to learn React is.. to learn Angular?!

Collapse
giovanniincammicia profile image
Giovanni Incammicia

Hi SaijuT, I've been working with React for 5 years now on projects of every size.
In my opinion, it is possible to have a large maintainable React project, but you really need a strong architectural design at the root to create the perfect folder/code structure for that project.
The biggest issues in React are component responsibility, communication and state-management. If every component is in the right place in the architecture and everything is done perfectly, then you're good.
Also, it's really important to think in React. Sometimes I see projects with a mix of React-style functional code, javascript classes (OOP stuff in general), hoc and other patterns.
Mixing is not good for maintainability. Which brings us to have a team that writes the same code (eslint helps with that). If not, it's just a nightmare.

Using a framework like Next.js or a state-management library like Redux helps less-experienced devs to have a forced structure which improves maintainability. Typescript and tests are also a must.

At the end of the day, maintainability is a matter of best practices and well-designed software. Sometimes we, as developers, prefer spending more time on coding than on planning stuff on a piece of paper.

This is just my opinion and experience so far. What do you think? :)

Collapse
cadienvan profile image
Michael Di Prisco Author

I completely agree with you. As soon as I started working with React I realized I could easily lose the point where some data is populated and passed in other parts of my application, nonetheless a nice architecture is built project after project and I'm pretty sure React can be used for big projects too. Thank you for sharing your experience Giovanni, and of course thanks SaijuT for the good question!

Collapse
shaijut profile image
Shaiju T

Appreciate 😄, for taking time to write. Actually as of today I have just learned Angular basics. Right now I am not in right position to compare both. But i asked the question with intention of just knowing what others think.

Few more questions:

  1. What you think about Angular is it more maintainable with build in Typescript support or is it up to the developer to make the project maintainable ?
  2. Have you used Typescript to build React apps or Just vanilla Javascript ?
Thread Thread
giovanniincammicia profile image
Giovanni Incammicia

I've used React with both vanilla Javascript and Typescript. My opinion on that is that with Typescript you don't have to worry about static type errors. It's just another thing off your mind. And kind of forces you to design more because you have to think in advance what kind of data you have/receive. So yes, it really helps with maintainability. Also, it's easier for other people to read through your code and know instantly if that prop is supposed to be a string, a number or both.

I don't know much about Angular, but what I know is that it has more of a horizontal structure, compared to the tree-like structure of React. This means that in Angular you have a few folders with many files, while in React is easier to work with many folders (one per component) with usually a lot of files within (js, styles, tests, reducers for state-management, schemas and types, API calls and so on).
Of course, in either of them, you can structure the folders as you most like them. But usually, you wouldn't want to go against the way the library thinks.

I hope that makes sense! :D

Thread Thread
cadienvan profile image
Michael Di Prisco Author

I'll give my two cents on the thread: React is more "free" and, in my opinion, is less feasible for junior developers. Even if angular has a steeper learning curve, it provides structure, rules and linting, something you have to do yourself in React. That's the point of this topic: React is empowered by Angular, in some ways.

Thread Thread
giovanniincammicia profile image
Giovanni Incammicia

Absolutely agree. Many things done by create-react-app (mostly linting and structure rules) have probably been taken from Angular and frameworks from every language. I believe we could gain experience from every library/framework we learn and use it with the most appropriate for the project (or simply our favourite, in simpler cases :) )