DEV Community

Cover image for Why choose React for frontend?

Why choose React for frontend?

Digvijay Jadhav on October 23, 2021

Before I dive into some of the cool things you can do with React, lets understand what is React. React JS is basically a JavaScript library built ...
Collapse
 
sroehrl profile image
neoan

Due to its dominance I work a lot with React. However, I personally disagree with a few key points of your post:

  1. It's easier to learn

How so? While Angular has indeed quite a learning curve, most other libraries and frameworks are easier to tackle. Have a look at something like Alpine JS for example. Even Vue is easier to conquer.

  1. Offers fast rendering

Well, compared to what? It neither shines against vanilla not other frameworks.

  1. Reusable components

Again a mute point. Component based structure is what EVERY big name out there does. So what is the difference? Does Angular not have reusable components? Or Vue? Or Lit?

I guess my problem is mostly that you describe things that are either true for more or less all frameworks or that your arguments aren't accurate or relevant. This in turn leads me to believe that you lack in-depth experience with other frameworks. That itself isn't an issue, but it's misleading in the sense that you explain React from a perspective of comparing options.

Collapse
 
elefint profile image
elefint

I would agree, I recently started dabbling with React / Angular / Vue. Vue was much easier to learn for a complete beginner.

Collapse
 
ashkanmohammadi profile image
Amohammadi2

Actually one of the reasons why I believe react is better than other frameworks is that it has a larger community support and, great development tooling and it has tons of different libraries for every use case. Also I should mention that react has maintained a much more stable API compared to Angular and Vue at this point.

From my perspective, these things make react the best choice for enterprise web application development.

But, react has some trade-offs too. Apart from the advantages of react that were mentioned above, react has some problems too:

  • Too much boilerplate code to write
  • Really complicated state management strategies
  • Too easy to abuse its features and develop applications in a wrong way

Sometimes, it's worth to use react and sometimes it's not. I believe choosing a web app framework depends on the type of project. The framework that fits your project's needs is the perfect choice.

Collapse
 
anubhav0fnu profile image
Anubhav

So which framework you vouch for?

Collapse
 
sroehrl profile image
neoan

Well, that depends on the situation. I didn't intend to imply that React isn't a good choice for many cases. However, if I was told I can only choose one framework, then I would probably go with Vue

Collapse
 
siy profile image
Sergiy Yevtushenko

Take a look at Solid.js. youtube.com/watch?v=Xw9XMNn2k0o

Collapse
 
vonziu profile image
Konrad Stącel • Edited

Easier to learn ?

  • JSX,
  • Hooks/redux,
  • function components/class components,
  • cssInJs/normal styling,
  • render props,
  • HOC,

And it is just a tip of the iceberg.
There is a lot to learn. Much more than for vue for example. The problem is that, it is hard for newcommer to know what to use and when, and that is what pushed me away from React(tried 3 times already and every time I did some react I was thinking: "Really ? It is that convoluted ? I can do it in Vue in 3 lines of code").

Collapse
 
joshnuss profile image
Joshua Nussbaum

I prefer Svelte, I find it easier to use than React. For example, here's a comparison of React Hooks vs Svelte

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
sroehrl profile image
neoan

I understand the excitement for it! However, it produces white a lot of transpiled code which leads me to believe bigger applications might suffer performance. However, I haven't built anything bigger with it yet so take this with a grain of salt.

Thread Thread
 
Sloan, the sloth mascot
Comment deleted
 
sroehrl profile image
neoan

Well, that didn't sound right considering the approach svelte takes, so I googled to see if anybody did an inflection analysis. You are of course right when it comes to smaller applications: since the "workload" is mostly done while transpiling most of our every-day projects will be WAAAY smaller with svelte. However, looking at the way it compartmentalizes code, it's clear that this advantage will eventually turn.
The nicest study on this I found is located at github.com/halfnelson/svelte-it-wi...

The good news is: the inflection point to React seems to be at beyond 130kb of source code, which is high enough for nearly every project. So over all, you are right in saying that there aren't any concerns.

There is something to be said about the way you look at this, though: neither the benchmarks you provided nor the pure bundle size comparison are suitable for performance evaluations. What you are actually interested in is what happens when you scale your application in order to evaluate whether or not a technology is suitable for industry-sized applications, as they tend to grow more or less indefinitely in the case of product success.

Collapse
 
cnayan profile image
Nayan Choudhary

You surely haven't tried Vue, when you mention simplicity and easy to learn. Vue 3 is coming up with similar state management. So, what's the point?

Besides, the article is very subjective and lacks data to convince that React is best.

Collapse
 
filipslezak profile image
FilipSlezak

React is not a framework.

Collapse
 
digvijayjadhav98 profile image
Digvijay Jadhav

Yes, It is JS library. Have explained below

Collapse
 
kachidk profile image
Nwanguma Victor

Why I refer React (personal opinion) is beacause React is pure javascript, and the lack of abstractions actually helped me learn Javascript. I love Vue (easy learning curve and simplicity in writing SFC) but when I use vue I tend to feel like a noob and forget some javascript concepts and inbuilt functions. I still use Vue tho, but It depends on the project and the people I'm working with.

I advice developers to learn the language, not the framework or library, I have seen developers fail interview questions because they know React or Vue instead of Javascript.

Collapse
 
pengeszikra profile image
Peter Vivo

In my opinion React greatest advantage is simple state handling. No one else can modify state, just action. That really simplify the software debugging, because most of the time enough check the state.

Second one is JSX, that is depend on pure JS and I can use any possibilities of modern ES6+. Really don't need to write any other files in project just JS files.
(in real case, we use scss and glsl files too).

Our html file is this:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>appercell</title>
</head>
<body>
  <div id="appercell"></div>
  <script src="./index.js"></script>  
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

In our really complex single page medical science application FE side written in react, hold 10k+ line of code, and react help keep our code well organised. Component reusability also true. Plus we can write a whole Component in a single arrow function ... really handy.

In this project shows me, the simple useState + useSagaReducer without redux or useContext is very useful even complex application.

Collapse
 
onekiloparsec profile image
Cédric Foellmi

Purely opinionated post. Most what is described is true for Vue.js (the only other I know). Even the bold fortune 500 companies argument is probably true for other frameworks... (large companies rarely have a consistent codebase throughout).

Collapse
 
husseinkizz profile image
Hussein Kizz

Let me also defend react here, but before that, I can truly say there's no better technology z than technology x but it depends on the use case, and am sure there some projects where maybe using other js frameworks like vue is the best option, however to me as a react developer I think react's power comes from it's popularity or community so that you can find that StackOverflow answer easily, and 2 is the ability to use libraries where someone did what you want to do in the best way possible and you don't have to reinvent the wheel like in some frameworks, this saves time and 3 react has seen a steady fast growth than other frameworks, we stated with classes, now hooks! and in all, react has a greater market in terms of employment than other frameworks. These are the reasons why I choose react, and by the way should we talk about its next???

Collapse
 
akashroykrishna profile image
Iroid Technologies

React is an excellent choice for frontend development due to its efficient rendering, component-based architecture, and thriving ecosystem. Its declarative syntax makes building complex UIs more manageable, and its virtual DOM enables high performance. Plus, its popularity ensures ample community support and resources for developers. Overall, React offers a powerful toolkit for creating dynamic and interactive user interfaces.

Hire React Native Developer India

Collapse
 
pavelee profile image
Paweł Ciosek • Edited

React advantage is simplicity. Low entry point make it the first choice for ppl who just need to learn modern web development in fast pace.

Cost of that is requirement of third party software for more advantage feature purpose, but it’s still good deal.

Collapse
 
akrambzgh profile image
Akram Bouzoualegh

I think is the best js framework for frontend so i choose it

Collapse
 
digvijayjadhav98 profile image
Digvijay Jadhav

Yeah! me too

Collapse
 
aryaashouri profile image
Arya Ashouri

Still by taking all these factors into consideration I'm confused why should I learn react. when I am acquainted with html and css and I can do whatever I want using them why should I learn that? article compared react with vue, angular, etc ... but not html css and that's right cause they are not frameworks but when I can do the same things in html and css why should I learn react? Is there any reasonable reason to learn that?

Collapse
 
pruthvi2103 profile image
Pruthvi Shetty

Trust me, the only reason you use react is because its easier to find answers and tools that solve your problem, nothing else

Collapse
 
jakeborromeo profile image
Jake Borromeo

For my case, I have to agree. But to me, that reasoning makes it a feature, not a bug

Collapse
 
shubhampatilsd profile image
Shubham Patil

I choose a JS framework based on how much code I can take from external libraries instead of writing my own 😤 💪

Collapse
 
bherrero profile image
Borja Herrero

We use Aurelia. It's not as much hyped as the other ones but it follows JS standards and it's definitely easier to learn for anyone with any JS knowledge.

Collapse
 
ultimategemini profile image
NF

No thanks!

Collapse
 
ebitzu profile image
eBitzu

Here come the React fan boys.. Angular on the 9th? Really? Source?