In 2016 I started my career in development, and at the end of the year, I created a mobile app using Ionic 2 (Angular 2).
It was very familiar to me because I used to do C# and Asp.net, so the structure was similar and made it easy for me to learn, we had the app ready for download at play store in a couple (or maybe a couple's couple) of months.
From that time up to now I learned so many things and React got into my radar. During some time I bootstrapped a few projects but never gave them much attention. So when I finally started a project (and did some work on it), I realized that a lot of things were better than Angular, and a few I wish were like it.
But what "disturbs" me the most, is the fact that React is considered a library and not a framework.
When I think of a JS library, jQuery immediately comes to mind. All you got to do to use it is add the script in your HTML (or import however you like) and voila, $ is ready for you.
It doesn't feel the same way about React. Maybe it's just a lack of knowledge from my part but, it behaves much more like Angular than jQuery.
Of course syntax is different and whatnot, but when I think about the use of a library it's much simpler than react's.
Am I being ignorant to what React really is or someone else feels like this?
Thank you all very much.
Oldest comments (33)
People have different definitions for library and framework
One definition I know is:
In terms of this definition, React is a framework.
But some people, especially in the front-end world, say a framework has to bring stuff like routers and/or widgets etc. pp.
So Angular, Ember.js and ExtJS are frameworks, but React isn't, because it only gives you the means to build components and render them into the DOM.
That's a common argument. I was talking to a friend a few momments ago and he said the same thing.
But to me, it seems that although React is smaller than Angular, and needs to be incremented by other libraries (in this case, I think that projects like react-router, redux or styled-components are really libraries), it still is a framework.
I allow it.
I'd have to say I use these definitions toargue that React is a library.
React is really only good for one thing: it's view library that give you a virtual Dom.
You can and should do everything else outside of react's lifecycle. The react lifecycle is only there to render your JSX (assuming you don't use react's built-in methods).
You should use pure js or other libraries to do anything other than render updates when you use react. State shouldn't be used for anything that doesn't directly effect rendering or render.
I see Angular and React as frameworks because you develop a Angular or React app, but when you use jQuery, you're just creating a web page that has some cool stuff.
I feel like React is very complex, specially when you include Redux and his friends. Don't know if this complexity comes from the mindset of a Angular dev, but when I first glanced React, it was very unfamiliar to me.
Of course React allows you to do things your way, but there's a structure to be followed in the end. In this topic, javascript allows you to do things the way you want, which is why there are so many libraries and frameworks.
It might look like that I dislike React, but the truth is I'm having lots of fun with it, and the learning process is steep but interesting.
I feel more productive with it, specially when it comes to creating components. Not having to declare every single component in
app.moduleis a wonder.The only thing I think is much more complicated, and it's probably due to my inexperience with React, is communicating with API (HTTP calls).
Because it does only 1 thing? Namely rendering components in HTML.
If it were a framework like Vue or Angular it would handle more problems like Routing, Animations and so on.
React is available right away too, like jQuery, has global variables. But same as jQuery it does nothing if you do not call it.
Also search and read for articles named "Imperative vs Declarative jQuery", you will see why and how the paradigm shifted.
Vue is a library right?
We use React very much like JQuery, simply bringing it in as a dependency. However, we use Webpack to facilitate React development by sprinkling some JSX in the mix. Without Webpack, we'd have to write all of our elements in a very cumbersome API that is pure JS. Webpack also let's us optimize tons of other things in the background such as cross-browser compatibility (for the most part). So, I think this whole magical setup of a React project with Webpack using
create-react-appis what gives us the false impression that React is a full-blown framework. However, when we compare what React provides us to Angular, we notice that React is just a component library when compared to Angular's routing, dependency injection, module management, etc. Also, Angular has some very opinionated ways of organizing the code base whereas React doesn't. When we use React, all of these additional features have to come from some other library, not Facebook (owner's of the React project).Another way to look at the difference between a framework and a library is how opinionated it is about your application structure.
A framework will commonly request or mandate that you extend specific classes, or put files in specific locations within the project. In addition, a framework will very often start itself, and your code is somehow started at some unspecified point in the future.
In contrast, a library will rarely mandate where to put your files, though it might require extending certain classes. More likely though, a good library works on interfaces, or else you use it's classes but not create your own. In addition, a library knows it cannot start your application for you, so you usually have to manually initialize it yourself.
I personally have not used React and so cannot say which one sounds more accurate.
Well there's react as in
npm install reactbut that's not the same thing as the react you see on SO or job boards "React developer wanted" or "How do you filter an array in react?"That's a very good point, you don't see job titles like "jQuery developer", but React developer is all over the place
That's not exactly what I meant. "jQuery developer" used to be not commonly sought and still is here and there.
My point was more that when prior refer to react, they're usually intending to mean "in the manner of a react developer".
Oops, my mistake. But I think I still don't get your point about the react developer
yeah I should have been clear.
The react library itself it fairly focused. It provides a JS-based component model, a virtual DOM abstraction, and that's about it.
But when people talk about 'react', that's not what they mean. They mean
and the list goes on.
Ohh yes, that's the point the, in my concept, makes React a framework or maybe something more than just a library, the amount of other libraries that creates the react ecosystem
I am of the opinion that
react(the package) is, in fact, a library. However, React as a whole has become a large ecosystem which is almost indistinguishable from a framework. While it is possible to usereactas a library, in practice, one actually adopts a large number of tools and libraries from the React ecosystem. How many applications are there really that just usereactwithout any related tooling or libraries?The very fact that the default way of using
reactinvolves the use of a specialized DSL that isn't valid Javascript (JSX) tells me that no, React is not just a humble library. Is it a framework, though? Technically, probably not. However, the end result doesn't feel that different.It reminds me a bit of the relationship between Ruby and Rails. While yes, technically, you can use Ruby without Rails, how many people actually do?
This is exactly what I thought.
When I think about just react, it's a simple and powerful library, but when it comes to developing a React application, you'll will (almost) always need router, redux and some other libraries that are "specific" and necessary to react.
In my opinion React is a library. It does one thing, it let you describe how one piece of the interface should look like.
The interesting thing is that people choose to use it as a framework, by reaching out to other packages in the react ecosystem. What ends up happening is that your code lives inside React.
Take a look at this examples
React as a framework
React as a library
That means that Facebook is bad in terminology :)
Why would a social media brand like Facebook be entitled to define the terminology of React? lol
I don't know but probably (probably!) it is because Facebook created React.