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.
Latest comments (33)
The correct definition that provides the difference between the library and the framework and the only one that makes sense :
"Your code calls library whereas framework calls your code."
Only this definition existed before unscrupulous React promoters started to promote it as a library.
React is obviously the framework. Very complex and opinionated one.
The litmus test:
Looking at the React tutorial Starter Code
ReactDOM.render()is the only part of React that your code calls. The rest, i.e. the majority of your code, is called by React.Ipso facto - React is a framework because it is in control when most of your code runs.
For the expanded argument see: React is a (view component) framework
For me, Angular is a framework - it's highly opiniated makes implicit assumption about your code and when there's a problem, you get a cryptic error message such as
'Unexpected value 'undefined' declared by the module 'DynamicTestModule' with a stack trace as high as a building entirely located inside Angular itself.
React is a library because you plug it into the part of your code you want, it is checking its input correctly and is focusing on doing one thing and doing it good instead of trying to do everything the bad way.
It's definitely NOT a framework. Something like "Create React App" or "Meteor" are frameworks that use React, but React on it's own does not run, it doesn't really do anything by itself. It needs Webpack or Rollup and all kinds of other tooling just to get up and running. React is a view library, that has an approach, but that's it. Frameworks are complete puzzles, React is just a piece of the puzzle.
I think we've heard all the arguments by now. Let me ask a question instead: does it really matter if React is a library or a framework? What are the consequences?
I don't think it really matter (in terms of usability), it's just interesting to see the discussion around this, and the points of view that makes this took so great.
I do believe that React should live in the middle of the framework vs library territory, but wether that's gonna change something I don't really think so.
Thank you for your input
I think you confuse react with the whole ecosystem around it.
A framework covers the edges, whereas a library is a tool to fulfill certain tasks. React itself only handles one task: abstracted Web Components. It provides an internal state, lifecycles and external properties and with ReactDOM a renderer for a browser or similar environment - and nothing more.
This has a few advantages: it is smaller than a full-featured framework, is less opinionated on how to solve problems and therefore allows for more choice. Don't like react-router? Use another one - or no router at all, if you don't need any. Need a complex state management? Try redux. Need to handle side-effects? you can choose between redux-thunks, redux-sagas and redux-observables. Unit testing can be done with enzyme, jest or mocha, sinon, chai, jasmine, karma, etc. There's no one or best way to do it, so you can do whatever works best for you.
So I guess the point that you and most of the other people here want to make is, that React itself, standalone, is technically! a library but because in 95% or so percent you will use the same libraries like react-router, redux, etc., the ecosystem of react is practically! a framework.
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.
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
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.
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