The largest library in the world

Mihai-Alexandru Cristea 29/12/2022 | 18:17

React is a library written in JavaScript that is used to work with interfaces. In 2011, it began to be used for the social network Facebook, and already in 2013, the library was made public and enthusiasts from all over the world began to create tools to expand its capabilities. You can add items to your shopping cart without reloading the page, or fill out forms without redirecting. The react.js creation services action is based on this.

 

For developers and users

JavaScript (JS) is the only programming language for describing the behavior of elements on a page in a browser: it makes interfaces interactive. A simple example of how JS works is a reaction to user actions: a mouse click opens a pop-up window; by clicking on the “Publish” button, the post appears without refreshing the page.

A library is code that other developers have written. Although React is often called a framework, this is not entirely true: the developer uses the code from the library in his program, and the code from the framework uses the developer’s code in itself. The library is a garage with cars, scooters, bicycles — you can take any transport and go wherever you want; a framework is a bus that you can put passengers on to get them from point A to point B.

 

What do we want to get?

To understand how React works and what its feature is, you need to understand two approaches to programming: imperative and declarative. Let’s do this on the example of a taxi.

  • If a passenger tells a driver: turn the steering wheel to the right, and now to the left, press the gas pedal, press the brake, — then this is an imperative approach. The passenger describes each action of the taxi driver to get the result.
  • If the passenger says the address, and the driver builds the route, monitors the gears and turns, — this is a declarative approach. The passenger describes the end result (the point at which you need to arrive) and the reaction to external events such as “if we get stuck in traffic, drop me off at the subway.”

React.js works on the idea of a declarative approach. This is called “UI — data function”: the developer describes how the interface behaves depending on data and events, for example:

  • for each user in the chat, draw a cross button in the list with avatars;
  • if the user clicked on the cross, remove from the list of users the one close to whose avatar this cross is.

Descriptions of UI blocks in React.js become the components from which the interface is assembled. Components are forms, buttons, fields, and application screens. The developer creates them himself or takes them from third-party libraries. It can also nest components inside each other, reuse or edit at once:

  • the developer describes the component using React
  • specifies all places where this component is rendered
  • React adds components to HTML
  • if the developer needs to modify a component, for example, change the color of a button, he specifies a new color for the desired component
  • React changes the color of all buttons, in all places where this component is displayed. No one forbids making the button color customizable for each specific component.

The trick is that creating and configuring components are separate processes. First, the developer explains how a component, such as a button, looks and behaves, and what properties can be configured. And then it places button configurations in different places, conditionally: in the form — medium green, in the bin — large yellow, on the main screen — small gray.

 

Four Benefits

1.     Versatility

React is a JavaScript library, and JavaScript is a popular programming language that is used everywhere. No other JS library works in so many environments and on so many devices.

 

2.     Flexibility

Digiteum’s experience suggests that React allows you to:

  • choose which libraries to use, for example, to control screen transitions and store data
  • change development tools
  • make an application entirely in React or use it for one feature
  • Great DevX — developer experience — how convenient, comfortable and easy it is for a developer to interact with technology.

 

3.     Popularity

  • managed to find solutions for all typical problems
  • came up with thousands of tools that make the life of a developer easier
  • formed a gigantic and ever-growing ecosystem around the library
  • the library has many users, there is someone to learn from and ask for advice.

 

4.     Readability

In React, the application is broken down into components, so 9 times out of 10 when it breaks, you can see which part of the code is in trouble. If something breaks in JavaScript, then the problem may be on the HTML side, and on the JS side, and at the junction of these technologies, when data and display are “out of sync”.

 

Four disadvantages

1.     Poor documentation

ReactJS is a relatively new technology and it continues to evolve with developers contributing to it and expanding its capabilities. But the documentation for React and related libraries is often lacking.

 

2.     Confusing JSX Syntax

ReactJS uses JSX, a special syntax extension for creating JavaScript objects, but through HTML syntax. However, the HTML syntax in the middle of the JavaScript code can be confusing for young developers.

 

3.     The complexity of search engine optimization

Google bots can easily index HTML pages. However, everything is not so smooth with JavaScript pages, because dynamic web applications, including those created on React, go through a complicated indexing procedure, unlike static web pages.

 

4.     Focus on the user interface

React is not an all-in-one tool for building an entire application. Therefore, if you follow the Model-View-Controller design pattern, then React will only be responsible for the view.

 

It all depends on the task

React has been successfully proven to be effective in creating interactive user interfaces, which is why it is so widely used. React has many advantages, but when building an app for business development, you should be aware of the disadvantages. For an expert assessment of the project, it is better to contact a specialist, such as in the Digiteum company.

 

Tags: ,
BR Magazine | Latest Issue

Download PDF or read online: December 2022 Issue | Business Review Magazine

The December 2022 issue of Business Review Magazine is now available in digital format, featuring the main cover story titled “Xclusiverse: Going Beyond the Traditional Ways of Doing Business.”
Mihai-Alexandru Cristea | 19/12/2022 | 18:45

    You will receive a download link for the latest issue of Business Review Magazine in PDF format, based on the completion of the form below.

    I agree with the Privacy policy of business-review.eu
    I agree with the storage and handling of my data by business-review.eu
    Advertisement Advertisement
    Close ×

    We use cookies for keeping our website reliable and secure, personalising content and ads, providing social media features and to analyse how our website is used.

    Accept & continue