You got your HTML in my Javascript!

I do love that bit.  Anyway, I’m with Officer Reeses.  Not on the whole “murder car accident victims and take their idea” front, but definitely that two great tastes can taste great together.

Most of my frontend work so far has been in Angular 1.5 and 2 (and of course, regular JS and jQuery in the good old days).  I’ve really been liking Angular 2 (may have mentioned that previously)- when paired with Typescript, it really makes for a nice dev experience.  I know es6 classes is somewhat controversial, but it’s nice as an organization tool for code if nothing else.  Having that class grouping and inheritance (I know it’s just a wrapper on normal JS prototyping, but it’s still nice), as well as a module system for easily including code/components from other files allows for small, related groupings of code more naturally (at least, in my opinion).

However, I’ve also started getting up to speed on React and so far I’m really loving it.  Using the Babel transpiler (or, I guess you could use Typescript in React as well- though it’s not as common), you can take advantage of classes and module loading and all that other goodness.  React seems a bit less of a wrapper than Angular does- example: There is no *ngFor looping in React- if you want to loop over an array of items and display them in a view, you just use a good old array method (map, forEach, etc).

And I think that’s where some of the Angular vs React argument comes from.  Do you prefer more html in your javascript or more javascript (or Angular’s version of javascript) in your html.

Having worked with one and dabbled so far in the other, it really seems like a toss up.  Once you’ve created a few modules in each, each approach seems to make good sense.  It would really just be a personal preference- but both make it easier to create the quick, responsive web apps people are starting to come to expect (unless you visit any food blog or other site littered with ads- those are just terrible).

So, did Angular get Javascript in your HTML?  Did React get HTML in your Javascript.  Who cares?  They’re the great tastes that taste great together!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s