Why would I React?

I’m a huge fan of Aurelia and haven’t taken much of a look at React (although I know its a big player in the javascript world). The little bit of code I’ve seen shows components where you’ve got HTML script embeded as text in javascript. I’m sure there are reasons to do this, but I actually like the separation of view and model that Aurelia provides.

So, I’m a bit curious - React and Aurelia definitely seem to be competing technologies? Are there situations where you would combine them? If one were starting a project from scratch, would there ever be a reason why you would consider using both or would you only ever do that if you were trying to migrate or add new functionality to an existing application?

Incidentally, I’m not interested in starting any kind of React vs. Aurelia war here – just looking for objective input. :slight_smile:


1 Like

Aurelia is reactive programming; React is… not (it’s more like pure functional programming).
We are talking about JavaScript after all, so yes, you can superglue the two to both work at the same time, if you so desire, but I don’t think they will work “together”.

There are certain concepts from React (more like Redux) that we can apply in Aurelia (using aurelia-store). For example, my common setup consists of a separate API and an Aurelia web app. All my form controls are bound to local variables that are only ever used in form submission. They never go back to the store. Form submissions actually call the API, and the RESULTS from API calls are the only things that ever goes to the store. So, in React terminology, my API calls are the “actions” and we strictly follow the one-way data flow. On the other hand, I’m still free to write my UI reactively according to values from the store, which - let’s be honest - much more fun than combining render().

Edit: on top of that, my UI also reacts to events happening outside my own feedback loop. It can be either actions made by other users (forwarded to my Aurelia app from the API) or just me open up console.log and test things out. React assumes that the actions are the only thing that should ever write to the store, which is good in production but rather limiting during dev and debug.


Aurelia is all about flexibility. Nowadays that is defined by how easy it is to incorporate any existing piece of work. Think of jquery widgets, native webcomponents or ng/react parts. The non-presence of Aurelia in your code is what makes it so easy to add these pieces. So it could make sense to incorporate an existing great component, e.g a full chat widget written in React, in your Aurelia app.
@khuongduybui also gave a good example of how ideas from other Frameworks can be reused/combined with the flexibility of Aurelia. To summarize I think if you come across something dobe great in React, dont hesitate incorporating it, if necessary with React together. Same applies for Vue, Ng and whatever is out there


Interestingly enough you can embed html in js within aurelia as well.

The following being just one of several ways to do it.

import { inlineView } from 'aurelia-framework';

   <span>Hello World</span>
export class MyComponent {

1 Like

Honestly, that’s one of the parts that is least appealing to me about React. I personally like that HTML is HTML and javascript is javascript (in Aurelia). There may be times one would need that in an app, but I’d rather have that as an exception rather than the rule. (Again, that comment is from someone who has never done React – maybe my tune would change if I actually started down that road – who knows)

Thanks you all for your input. It sounds like Aurelia is flexible enough to allow one to leverage code from other frameworks - which is great.

I’m a little curious if there is anything that React offers that is not found in Aurelia. Granted, the means of accomplishing things might be different, but React in and of itself doesn’t offer any features or abilities that are not possible via Aurelia – correct? Again, just trying to get a feel for if there is a real difference in one framework over another or if its just a matter of personal preference.

1 Like

The tons of libraries / components that sometimes is just quick and easy to grab and plug in.

1 Like

I think it is worth at least a shallow dive into React because it is so very different from everything else. There are some good ideas there that can be applied to the way you think about your Aurelia applications. I’ve been writing an enterprise scale React app for the past 6 months or so though and haven’t yet discovered anything that React has that Aurelia is missing. The two are just fundamentally different approaches to web development, each with their own pros and cons.

I’ll end with the same bit I tell React devs about Aurelia: When it doubt, just try it.