DEV Community

Cover image for Is using React the best way to web development?
Atif Aiman
Atif Aiman

Posted on

Is using React the best way to web development?

Salam and Hello!

Before I make any statement here, React IS one of the way to web development. Of course, with all the supports garnered from the community, React is a to-go framework for modern web app. Well, I already 2 years with React, so of course my opinion might be bias, even a bit.

So, back to our topic. Is using React the best way to web development?

Javascript frameworks

The logo of all Javascript framworks

There are a lot of Javascript frameworks. React, Vue, Angular, Svelte, you name it! With each frameworks, they offered stucture, mental modal, and philosophy behind the frameworks. Component-based, virtual vs real DOM manipulation, event change management are only a bit of features offered by these frameworks that makes them a good-to-go framework for modern web app.

However, as we live in a community, everyone has their opinions to their own, especially the OG in the industry. They have been trying these frameworks since it was born, let alone the usage of vanilla Javascript, JQuery and other origins.

Then, comes the existence of NodeJS, to support these frameworks outside browser's V8 engine, so that the codes can be run without any problem. Then comes the other issue such as optimization, performance, Lighthouse benchmarks and others.

There are a lot of things to consider when starting a framework, right? Well, let's go for more details in React.

React Framework

As stated, there are 3 niche that they offered along with the framework.

Declarative: Declarative views make your code more predictable and easier to debug.

Component-Based: Build encapsulated components that manage their own state, then compose them to make complex UIs.

Learn Once, Write Anywhere: We don’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code.

Let me try to put it in a simple way. You can create your own component, split the code for each component, declare the component by giving it a proper name, and the pattern can be used anywhere, without having to repeat yourself.

React is using virtual DOM (Document Object Model) manipulation, means that the event changes happened behind the scene, and the page will be ready, even before you realise it! Compare to traditional approach, you need to target specific DOM Object, and trigger the change yourself. If you didn't know how to modify it, it might trigger performance issue.

JSX is always a word play for React, because everything happened inside React is always Javascript code. You might think that you are coding in HTML inside Javascript, when in fact, you are actually writing in React DOM Object form, which known as JSX! That is the reason, why React uses className instead of class, htmlFor instead of for and also using camelCase for other HTML parameters. Some of the parameters are actually a reserved word inside Javascript, that is why they need to modify it that way.

To handle event changes, React is using state and props, which allows React to monitor the changes and prepare for DOM manipulation. State is what defines changes inside components, and props is what component uses to communicate with other components. With this in mind, React is more suitable for compositioning rather than inheritance.

React can be done using 2 patterns. One, is class components, and other is functional components. There is no wrong way in managing your components, though most, including myself feels that using OOP (Object-Oriented Programming) pattern by using class components is actually anti-pattern, as I said before that it is more compositioning than inheritance. But, you do you, and of course it depends on use case.

There are still a lot of thing about React, but I think these are some main takeaway when people decide to use React.

Let's be critical

When using a tool, we should always see how it benefit us, and how can it be to our disadvantage.

The fact that it uses JSX, some of beginners find it difficult to follow. The difference in syntax makes it hard to switch knowledge between standard HTML and JSX pattern. However, I fairly believe this factor is not bothering that much.

State and props concept. This is one of the factor that makes learning React hard to grasp. Personally, during my first 3 months of using React, I am still confused with these concept that I am not familiar. But maybe, I will explain these concept in my next article? πŸ€”

React is fully Javascript, means that everything you write, you have to know how Javascript works. For this reason, it brings a lot of other concerns, such as the mastery of Javascript, the optimisation, the synchronisations, and others.

Skipping to react!

There's another debate whether React, or even any other JS frameworks is needed in web development, since it depends on the requirement. There are a lot of web page, that only serve to display a single, scrollable page, without any routes whatsoever. So, the conservatives believe that you didn't even need to use React, just to build that web. Let's call them "The Amish of Web"!

Some even consider the learning curve of React, so instead of going for React, they want to learn Vue instead (no hate though, I am currently using Vue for my current project!), since Vue is more beginner-friendly, and closely related to standard HTML pattern, and using Handlebar-like to handle data.

The (Possible) learning curve

So, is React the best way?

Okay. Put all the pros and cons aside for a while, and ask yourself this question first.

"Are you just starting to learn frontend development?"
"Do you want to learn, for your own objective, such as changing career?"
"Are you a beginner in this Javascript thingy?"
"Do you want to be up and running after learning these knowledges?"

As long as there is "learning", there is never a wrong way of picking up what you want to learn. Of course, there are other consideration such as marketability, urgency and others, but I will again say, there is never a wrong way to be someone you want.

For me, gatekeeping is actually a bad thing to do, especially the senior in industry. We need to realise that we are, indeed a beginner once, asking the same thing to ourselves, of what we want to be in future. We were once stupid, and will always be. There are no limitation of what you want to learn.

However! However! Of course, you need to know how to "learn". Stop thinking too much, scrolling the forums to see what is the best way, and read all these OG's debate on what is "their best way". Take whatever constructive, and keep those in mind, walk away, and keep proceed to learn, so that in future, when you have the expertise, you know what you will do to tackle those issues. Learning is a never-ending process, a lifetime opportunity that is given to us, picking up whatever interests and benefits us.

But of course, no Angular! 😈 Hahahahahahaha just kidding!

Remember Atif, no gatekeeping! Let other people learn what they want. Give them guide whenever they need. Yes Atif, be compassionate!

To you, peace be upon ya!

Top comments (0)