In my advanced age, I’ve discovered I like change less and less, which may explain why it took me so long to come around to
love enjoy React. If you’ve followed this blog at all, you’re no doubt familiar with my love/hate/love relationship with ReactJS. While I love a lot of what React offers in the way of component based architecture, re-usable elements and advances in making the framework more accessible through create-react-app, there’s still the issue of the state.
Ahh, the state of state in React. So, you got a few options: mobx, flux or the crowd-favorite Redux. Though Redux and React go together like SQL and .NET, they are two completely different frameworks. The only real state management React offers out of the box is passing props around which can get hairy. Using Redux made me pine for Angular’s sweet, sweet factories and services which allow you to communicate between controllers (why do they have both factories && services…. who knows, they basically do the same thing). A service in Angular is a module, composed of an object which usually returns functions which can be injected into other components as a dependency. You know what’s even better about factories and services? They’re built right the fuck in there. Yeah.
My mind was blown once I saw an Angular 4 app scaffolded using their CLI and ready to be served using webpack in a few commands. While there’s many similarities between React and Angular as far as using component based architecture, use of web pack and the very familiar file structure, what sold me was when I saw they were still using services to communicate across controllers. No external libraries or insane amount of files to create a simple connection between pieces of the app, just baked in simple logic to do what should be a fairly simple task.
I honestly don’t know why everyone isn’t using Angular at this point. I’ll continue using ReactJS because it’s a lot of fun but I guarantee my next project will be using my old friend in a new way. Check out the docs
to see how easy it is to begin building an
AngularJS Angular app.