React and Angular do not fit everywhere
Last few years have been fascinating with several front-end frameworks coming up. I am not going to compare them; neither am I going to talk about The Good or The Bad on them. The buzz words, the new technologies are so shiny that almost everyone I speak to today wants to work on the new stuff. And they also tend to believe that you can solve everything by just writing a front-end application, make some API calls and it’s done. The focus of this post will be that React, or Angular or Vue.js or anything similar is not one size fit all frameworks and Servers Side Code still has a place in this world.
Consider building droplets of React/Angular applications inside of a bigger Multi-Page Application
A while back we used to evaluate and see the work we want to do for a website and check if it falls into the category of being a Single Page Application (SPA)? Since then the lines have merged, and we have seen several cases where we may have a multi-page application, but the interactions on a specific page may still need dynamic updates. Building a Single-Page Application isn’t the right answer if all you need is compartmentalised updates. You should instead consider making a Server side application with individual pages having their own entity, and within a page, you may drop in Dynamic Apps built with React or Angular.
A single-page application has its own disadvantages you should be aware of:
- Building Browser history and making back button is a bit of task: Many people expect to hit the back button on their trackpads/mouse and wait to go back to the previous state. Any AJAX based action or SPA application will not handle this out of the box, and you may have to hand such complexities.
- Scroll Positions mess up: As you load new sections of pages, the page positions doesn’t adjust to the newly loaded content, and you may have to handle the complexities of the same
- SEO is an afterthought: every page URL you have has its own SEO value. By building an SEO application, you take a significant hit on SEO anyways. It can be done, but the amount of work you have to put in to make SEO success is a lot of hard and complicated work
- JS/CSS Performance: The easiest way is to compile all JS and CSS into one file and load it all up. When you start putting the entire application into a single page, you also put all the JS/CSS on a separate page including the ones you do not need at the start and may never need in the certain use case for some users. While a MPA, allow you to load your JS/CSS as per the needs, that’s something additional you have to handle in a SPA
There are a lot more cases, but the intent of this post is not to harp on the point, it’s to invoke a thought – yes you know React and Angular. Yes, they are fantastic web JS frameworks but are you ready to let go the power of am Application Server? Think again.
Published on Web Code Geeks with permission by Kapil Viren Ahuja, partner at our WCG program. See the original article here: React and Angular do not fit everywhere Opinions expressed by Web Code Geeks contributors are their own. |