It is better to understand deeply library or framework you want to work on. So, you can decide whether it fits in your requirement or not? If you are trying to use React.js in your project then this article is for you. We will deep dive into React.js and understand how this library is different from other popular frameworks such as Angular, Vue.js and Ember.
Framework vs Library
React.js is a library. Angular, Vue.js and Ember are Frameworks. Now a framework isn’t fundamentally better than a library; it’s a trade-off.
Here are a few advantages to choosing the framework approach.
1] A framework contains more opinions, so you can avoid spending time trying to choose between many options.
2] Framework reduces decision fatigue.
3] There is often less setup overhead.
4] Frameworks can help enforce consistency since most frameworks are more opinionated.
Here are a few advantages to choosing the React.js (library) approach.
1] React is significantly smaller than most frameworks. This means that it’s small enough that you can sprinkle it on existing applications so that you can slowly migrate an existing app to React, even a server-side rendered app.
Imagine you have an existing app built in .Net, Java, PHP Whatever. Since React is small and flexible you can replace a single component on the page with a react component. So, you can use your React components anywhere because they’re light-weight. This is precisely how Facebook slowly rendered from a server-side rendered PHP application to React.
2] React doesn’t force many decisions on you. It allows you to only pull in the features that you need to keep your app lean and fast. You’re free to pick the precise technologies that you need for your project.
3] Decision fatigue is also largely a solved problem with React because opinionated boilerplate like create-react-app effectively turn to React into an optional framework. Now, since React is a focused component library, more comprehensive frameworks like Angular come bundled with more features, including testing, a library for HTTP calls, routing, and internationalization all built in.
In contrast with React, you select the pieces that apply to your use case and you add them in. Since React is very popular, there’s almost certainly a mature library that does what you need. Here are just a few of the most popular options for each use case. And the nice thing with React is your users don’t have to waste time downloading and parsing features that they don’t use. You can pull in only what you need from this list.
|HTTP Library||Fetch, Axios||✔|
We hope you got a better understanding of how React.js is different from other frameworks. Start using React.js in your applications. We will come up with more React articles.