Can Redux and Angular REALLY be combined; yes!

It’s all about “state”.

You will undoubtedly soon need to integrate #React into your #Angular apps (why? Because that’s the direction of the world –moving to #React). And it’s not easy.  Angular is an entirely different animal and both worlds want to be on-top or in-control.  Sure, any app (SPA or otherwise) can cross pages into other sites/pages, right? But try continuing a user-consistent state-aware feeling.

What most companies I see doing now (costly) is just rewriting.  Which ultimately I think is the right longer term approach.  But can there be baby steps?

Here’s where the server-side can help you: State.  It is not a panacea, but might help some companies “get going”.

Let’s just assume your main app is Angular based.  But you have some new cool pages written by your React team.  Overall targeting the same user-base/class (say, shopping cart) and ultimately attacking the same back-end database/REST/services.

The current proposed solutions are very complicated and strange.  While we all love SPAs, maybe for brief moments of your app you can allow your user to move to a new page (meaning: it could be written in anything, even jsp/faces!) or an iFrame (horror of horrors, but recall, we’re trying to take baby steps).  So very simply: Send “state” to the server (some REST JSON tree) and then xfer control and use session or web tokens or such. I know it’s obvious, but it can be done in such a way the user wont know.  Most of the critical state of an app is probably stored on the server side anyway. They key is the “feeling” which means add-in some state that is UI-unique (user/login, page position, form fields partially filled in, and onwards).

When I look at my React apps, most of my components (well, my Containers) are pretty much stand alone.  They talk to the server largely separately. And through “context” share some state data between them (like: login, cart, active page, position, some session data, so forth). In fact, I could take each of my Containers and make them their own SPA and bind them with this technique.

Now, doesn’t THAT speak services-orientation!!  Try and let us know!!

Leave a Comment

Your email address will not be published. Required fields are marked *