DEV Community

Discussion on: Why is React a library and not a (simple) framework?

Collapse
 
kayis profile image
K

People have different definitions for library and framework

One definition I know is:

  • a framework is a software where you plug your code into
  • a library is a software that you plug into your code

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.

Collapse
 
dkamer profile image
David Joseph Kamer

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.

Collapse
 
renannobile profile image
Renan Lourençoni Nobile

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.

Collapse
 
kayis profile image
K

I allow it.