When seeing https://dev.to/itsjzt/why-there-is-so-much-hype-around-doing-things-in-javascript-8ne I as a web developer immediately got another question in mind:
Why is there so much hype around React.js?
Yes, typically people argue with Facebook as a big backer and the nowadays tremendous ecosystem. But a big part of this ecosystem for example tries to solve problems that only exist because of React. The way it works seems to be completely contrary to existing web technologies, so that more and more convenience libraries are written to make things work in React, that already would work without it. React is also neither the fastest nor the most convenient way to do componented web applications. It's speedy but also not the fastest in rendering.
So what's it that draws people to it?
Top comments (9)
React's not a silver bullet. And you're right to point out that problems are coming up because of React.
However, when you think back to when React first came out, JavaScript was in a different place than it is today. JavaScript used to mean jQuery and/or BackboneJS (for a lot of people). While these framework's were ok they got messy when you started to make larger SPA's or just complex applications in general.
React came along and made making the UI layer of your app much simpler. No need to worry about event handlers and tying your business logic to the DOM (data attributes anyone?). You could whip up some components, use React's state to manage UI logic and you'd be all set. It was a breath of fresh air, and to many, it still is.
All that to say is that React was one of the first frameworks to think of a JavaScript UI differently and decoupled things from jQuery soup. Yeah, it's starting to show it's age a bit nowadays, and it may not be the fastest for small to medium size JS apps. But it's got a ton of documentation and examples on the web and it gets things done.
Sorry but I think people get my intention wrong. I'm not new to react, reactive UIs or components. I have a whole lot of experience with it. I even wrote a piece in how to write your own reactivity system (using vuejs' system as example).
Also, neither components nor reactivity are new. React might be first of its kind but its single parts all existed before. Saying only jquery and backbone where before completely ignores AngularJS, Polymer, EmberJS and others that came before react to solve the biggest problems at the time in frontend development: code organization and coding convenience. React actually goes one step back in being a good tool for UI state management but not delivering any other coder convenience or code structure by default.
This is by design, I believe. React is a library - a minimal set of components just to work with the view layer. Versus Angular and Ember, which are frameworks that include everything under the sun.
But yes, there is no defined structure for a React app. There are best practices, but it's up to you on how you structure your app. I think a lot of devs like this flexibility over something like Angular or Ember's opinionated defaults.
The reason? Big Company X uses it for their spectacularly successful product. So that means the tech they used is good right? Well, no it actually doesn't. In fact, many are successful in spite of it. But we don't find out about the pain until after the headlines have faded.
I've followed the hype many times before too, so I'm not talking down to anybody here. It is just human nature: "Nothing attracts a crowd like a crowd."
Nowadays, I make sure to research techs to find out what their trade-offs are, no matter how awesome Google or FB says it is. Many techs are amazing tools, but they are for problems I don't have. So I file that research away until I notice that I have that problem.
It really doesn't matter which framework people choose, all of them are a means to an end.
Each tool was made in response to a perceived problem that a developer saw, and developed a community around the solution to the problem.
Which ever tool people can relate to more, people will migrate towards.
Angular/TypeScript is great for people who come from more classical languages like Java.
Ember has tons of documentation on how to integrate with Ruby, so there's tons of developers based in Ruby there.
React is for people who value being "cutting-edge" and prefer simple libraries over full-featured frameworks.
Why the React Hype?
In regards to React, I feel like its the most popular for two reasons:
Reason 1: New Developers!
There's a new generation of developers that are coming into the market, and people have a tendency to follow trends and the job market, which is okay!
From teaching other people, I've seen people become attracted to React because of the idea that it's a view library rather than a full-featured framework like Angular or Ember. (which are super opinionated by the way)
Since React also has all the gotchas of JavaScript, a lot of people become more proficient JavaScript developers as a result of using React.
(obviously people are using create-react-app to hide the complexity of the dev tooling)
Reason 2: The Development Experience is Amazing
I'd argue that the problems that people are trying to solve are in regards to specific use cases, and dev environment tooling.
Web development has never been easier once you have your environment set up in React, and at least I know personally I don't want to go back to the way it was before.
It also has a ton of documentation, a huge well known team supporting it, with new features making it better every day. What else could you want as a web developer?
At The End of the Day
It's all your choice, and that makes it all the better.
Web development has never been more complex than today. But developing Javascript UI apps is far easier today. Not every web application needs reactivity at entire level. No code is simpler than no code at all.
The reality is people think of React as a silver bullet: The right way to think about UI development.
The concepts used and encouraged by React community is not new, they had been existing since decades ago but the marketing effort put on it by Facebook made it what it is today. The effect compounded when the entire enterprise industry found a new way to address its strategical problems like dealing with large team size. Then compounded again when consultants/architects/freelancers and at some level corporate developers found a new field to charge customers for what they didn’t need at first place, likely.
React is great as a library and as a piece of code and as a community but there are dynamics around it like what I described.
The same applies to some other trends in software development industry. Microservices for instance. Like any other industry in the wolrd consumers of products are directed by the marketing decisions of suppliers. This is not bad by nature but it has some side effects like standardizing methods in which it may lead to higher cost of software development and low quality products
I think the component-based architecture makes code very maintainable and reusable. Especially on large projects with lots of developers. React was the first widely used framework that implemented component-based architecture rather than the usual separation of concerns between either MVC or CSS/HTML/JS.
Because it does things differently and people love new things
If you don't get why guys are using React, see this example:
<p> {likes} People liked your pic</p>
So, you can see
likes
is the number of likes you got on your pic but and best part it's dynamic if one more person will like it, it will be updated you don't need to update it (like in Jquery).It will update automatically if you change its state.If you are saying you can also update it manually then in real world apps there are tons of states and you have to update each of them manually.
you can take ReactForBeginners course to level up your react skills.
Hi Saurabh,
DOM manipulation is a standard in new JS library and framework. Personnally, I wouldn't choose a library if it don't do that. Remember jQuery ? What a mess.
But there are some points that I look for when I'm searching a framework for my front-end stack :
It's interesting to see how AngularJS (1.x) and React dealed with DOM manipulation before the democratisation of the shadow DOM. When AngularJS works with dirty checking and a digest cycle for DOM manipulation, React introduces the virtual DOM. Both of these methods solved A LOT of problems but now, with the shadow DOM, these methods are completely outdated (see this stackoverflow thread for more info).
I would say that working with AngularJS and React is fine, really! I use AngularJS 1.6 at my work and it does the job and we didn't plan to change it yet. But if I need a new stack, I will choose a framework which implements more recent technologies like VueJS (which rocks btw).
Have a good day ! :)
Edit: misspelling and grammar...