DEV Community

Discussion on: 7 Reasons Why React is King of JavaScript UI Frameworks

Collapse
 
devdufutur profile image
Rudy Nappée

Since hooks and context, React can be seen as a framework, not as rigid as angular but still, you don't really need anything else.

Collapse
 
kodipe profile image
Konrad Przydział

Hooks and context have nothing to do with "framework". React is a UI library due to lack of concrete architecture IMO.

Thread Thread
 
brense profile image
Rense Bakker

Framework: "a supporting structure around which something can be built"

Cambridge dictionary: framework

What you're trying to say, it doesn't fit the angular definition of itself and angular calls itself a framework, so everything else is now not a framework? Thats not how words work :P Angular is a different kind of very opinionated framework. Opinionated frameworks are nice if everyone has the same opinion, which was (more or less) briefly the case when angular was first introduced, because it made 2-way data binding easy. Something which was hard(er) in other frameworks of the time like Backbone.js.

React very much defines a supporting structure around which something can be built. The built-in hooks are part of that structure. For an incomplete reference, take a look here: reactjs.org/docs/react-api.html or look at the typedefs for the React object to see what supporting structure React defines :P

Why are we even having this discussion? The trends are extremely obvious, angular is done. 2021.stateofjs.com/en-US/libraries... angular hasnt been popular even before Russia invaded Crimea :B You might as well try to defend ember.js 😅

Thread Thread
 
devdufutur profile image
Rudy Nappée

IMO it's a (light) framework because you don't have to add anything to write full featured applications et scale. I mention hooks because before them we needed a state management tool like redux.

Furthermore React enforce an opiniated unidirectional flowed component based architecture.

Thread Thread
 
kodipe profile image
Konrad Przydział

@brense I didn't mentioned Angular and its definition of framework, also I didn't defend any framework at all - just talk about React itself.

From my perspective React was and still is a library which solve exactly one problem - playing with VirtualDOM (and side effects) and translating it to changes in DOM. Of course you can write whole application around React but you can do it also around any other library like e.g. jQuery which solve also one problem.

Any other typicall problems like communication with API, state management, routing are solved not by React but 3rd-party libraries which in many cases just integrate other 3rd-party libraries with React (e.g. Redux).

When it comes to architecture/structure topic, React just reacts on certain side effects and run composed functions if something has been changed to modify VirtualDOM and DOM after all. I don't see here anything about supporting structure.

Thread Thread
 
brense profile image
Rense Bakker

I'm not sure how API communication and state management or routing translate to "structure" for you... IMHO those are domain specific choices. Some business logic doesnt even need routing or API calls...

React doesnt tell you how you should structure your code, thats not the definition of a framework. A framework IS a supporting structure ontop of which you can build. Which is exactly what React is. A framework that tells you how YOU should structure whatever you're building is opinionated and will ultimately fail because it can't keep up with rapid changes in software development.

Thread Thread
 
lalislau profile image
Marcos

It´s possible to mix angular and react in the same front-end project? React and vue, react and svelte? So you can call it a library. If not, react can be called a framework?

Thread Thread
 
brense profile image
Rense Bakker

Well technically anything is possible, but no, generally it's not a practice to include React in an angular project or vise versa etc.