DEV Community

Praveen Kumar K
Praveen Kumar K

Posted on

What is react js? Difference between libraries and frameworks?

What is React?

React is a front-end JavaScript library.

React was developed by the Facebook Software Engineer Jordan Walke.

React is also known as React.js or ReactJS.

React is a tool for building UI components.

How does React Work?

React creates a VIRTUAL DOM in memory.

Instead of manipulating the browser's DOM directly, React creates a virtual DOM in memory, where it does all the necessary manipulating, before making the changes in the browser DOM.

React only changes what needs to be changed!

React finds out what changes have been made, and changes only what needs to be changed.

Difference between node js and frame work.

Library:

A library is a collection of pre-written code that developers can use in their programs. It provides specific functions or classes that can be called by the application code.

More Control:

Developers have more control when using libraries. They can choose which functions or classes to use and how to integrate them into their code.

Specific Usage:

Libraries are typically used for specific tasks. For example, a graphics library might provide functions for drawing shapes and images.

More flexible:

Developers have more flexibility when using libraries, picking and choosing specific components as needed. Frameworks are often less flexible in terms of structure and conventions.

Lower learning curve:

Library has generally a lower learning curve since developers can choose specific components to use without being required to understand the entire library.

Framework:

A framework is a more comprehensive and structured collection of pre-written code that provides a skeleton for building applications.

Steeper learning curve:
Frameworks may have a steeper learning curve as developers need to understand the framework’s architecture, conventions, and overall structure.

Less Control/Flexibilty:

framework dictates the overall structure and flow of the application. Developers need to follow the framework’s conventions and structure.

Higher level of abstraction :

Frameworks provide a higher level of abstraction and control the flow of the application.

Build entire applications:

Frameworks are used to build entire applications. They often come with predefined patterns, tools, and best practices for developing within a specific domain, such as web development or mobile app development.

Development Speed :

Library: Can potentially lead to faster development as developers can quickly integrate specific functionalities without following a predefined structure.

Framework: May initially slow down development due to the learning curve, but can lead to faster development in the long run by providing a consistent structure and reducing the need for certain repetitive tasks.

Lets understand the
differences between libraries and frameworks with some examples:

Library Examples:

Requests (Python): Requests is a popular HTTP library for Python that simplifies sending HTTP requests and handling responses.

Standard Template Library (STL) in C++ : It is a collection of template classes and functions that provide general-purpose classes and algorithms with templates.

Framework Examples:

Expressjs (JavaScript): Express.js is a web application framework for Node.js. It provides a structure for building web applications and APIs, handling routing, middleware, and other aspects of web development.

Django (Python):

It is a high-level web framework for Python. It follows the Model-View-Controller (MVC) pattern and provides set of tools for building web applications, including an ORM, templating engine, and authentication mechanisms.

Hybrid Examples:

Spring (Java): While often considered a framework, Spring can also be used as a collection of libraries. It provides various modules for different concerns like data access, security, and messaging.

React (JavaScript): React is often referred to as a library for building user interfaces, but it can also be seen as a framework when used with additional tools like React Router and Redux. React itself focuses on the view layer, providing a component-based approach to UI development.

Top comments (0)