Everything You Should Know About React: The Basics You Need to Choose Front-End Technology

Specialist’s opinion

Данила Гегеле
Eulerr
7 min readNov 27, 2017

--

Before you start

React JavaScript library allows to make website look as it should look. As well as from users’ side as from developers’ and customers’ one.

Most of web developers should say thanks to guys from Facebook, who have developed React. Due to them we can use native applications’ technologies developing the website. Also, it’s become easier to make fast and responsive interface, to reduce the time of waiting for content download, to make user reach landing pages and key features in the most effective way.

Reactive displaying of the website

The conception of instant data displaying allows to achieve such an amazing result: speed. Once we have a data, the only thing lasts is to show the data in a required form. You shouldn’t ask for it on server each time you want to do that.

  1. For an example lets look through the classical case of adding the products to the shopping bag by user. As soon as the customer visits a product’s or catalog’s page he presses the “Add to bag” button and goes right to the shopping bag page. Thus, there is no need to ask the data about the product from server. You shouldn’t do that cause the user has just pressed the button at the product’s page — so you have all necessary data (even more than needed), so what’s the problem to show that as a shopping bag? If your choice is ReactJS than you will not face such a problem. The displaying changes REACTively!
  2. One more example which shows how reactive may be the displaying of the content with ReactJS is a news block. After going to the news list you choose the one you found interesting, read it and return to the news list again. If you develop the service without React, you should load the list again, but we don’t need this kind of headache, do we? React will return you to the news list in a blink of an eye!
    Those simple cases show us the power of React in development of the websites. However, if you dream to use all of the React functionality, let look to the CRM systems.
    There are a lot of different data types which should always be at the page. To work comfortable, the page shouldn’t reload each 5 minutes
    ( which is really easy to do with React )

API+ReactJS architecture

The users feel satisfied, but even more complicated tasks are easy to complete in React. If you do support successful project for a long time you will face the following problems:

Data safety

A common situation, when you need to enlarge the shopping bag functionality. The new feature is the possibility to pay by coupons or bonus points. There are programmers to develop back end. Also, we need a UI designer to make our dreams about new stylish functionality come true.

And here the problem appears. Can we feel confident about a new person? Won’t he steal our clients’ data? The project architecture built with server API will solve the problem. This projecting conception is perfect to use with React.

The UI programmer have an access to the data displaying only. Furthermore, we can limit the access to some API methods, giving the developer a minimal needed functionality.

As the result, the programmer will use all existing data about the project, upload a new one. And we have a total control over the access to data, which allows us to protect it.

Scalability of the project

Year by year the project is growing. Sites’ code also becomes bigger.
One day you will face the moment when adding even minor functionality is really hard. Even the site become a problem. You shouldn’t forget about applications and widgets e.t.c.

Your project may grow as fast as Dubai!

To solve the problem you should use the API site architecture which divides the data displaying and server requests.

  • API, being a set of methods is very easy to maintain, document and test.
  • React being used with the right approach is also the set of modules, which are clearly correlated with API methods.

In total, that kind of architecture is more reliable, scalable and allows to use an autotest tools. We create one point to have an access to data. Then, we have as many opportunities to display that data as we could imagine. Is it a site,mobile application, watch. smart-TV or a smart fridge! We shouldn’t care!

Doubtless, those clients whose project is developing for some years are luckers! Although, your business has just started, you have nothing to hide, but you need a site, as soon as possible! You’re ready to hire 4 developers and pay them. Here is more problems appear! They should work parallel.
The relevance of database is the first thing that we should think about. Back End developers change it’s structure actively, develop and install new modules. Content specialists add new materials, and so on and so forth. The front end developer have a task to make a fast mockup. But he can’t! Backend code and database are not relevant.

In a classical approach we solve the problem giving an access to a remote database, but it reduces the page load speed because to display the page more than 50 requests should be done! As a result, client pays more to the Front End specialist. The developer wastes time waiting server to respond and you waste your money, which may be spent more useful.

React + API show and incredible result again! We fully isolate backend and frontend from each other.

Front and back end developers live in peace and do not disturb each other.

Frontend developer does not suffer from changes in the database or server code. Instead of making 50 database requests he should only make a 3–4 API requests. He will got all the image links from the server rather than downloading a gigabytes of files. Frontend coder should not install new Ruby update package for Windows to have an access to site. With React + API he works, works and works with the real data which may be very different from the template texts and values that are represented in the design.

The backend programmers should not go deep in a frontend and guess what each class, or modificator means.

Dividing the responsibility zones we make the development more stable and fast, reducing the risk of downtime through the fault of one of the team members.

And what will happen with the admin page beloved by most of clients? They have spent so much time studying how to work with it, they have learnt how to add and update data quickly and reliably. Relax, everything is fine! Each modern CMS system is able to refuse the use of server’s template engines, moving to the API architecture and uploading data in a new format.

Search engines, SEO, Sharing

The indexing and promotion of applications is one of the problems which may appear. Does it mean that sites built with React are also hard to promote and index? No, you may use the open source service prerender.io to give ready HTML pages to the search engines.

Houston, we have a problem!

Some of popular and beloved frontend plugins are not easy adapted to work with React. However, by now, we haven’t encountered any unsolvable tasks in our practice. Technology is advancing very rapidly and acquires all the new tools.

Repeating the material

Cheer up, you’re close to the finish line!
  1. React — is a javascript library made by Facebook. We can use it for creating fast and responsive website. Wait less, display the data faster!
  2. Server API + React architecture allows to make safe, scalable and and maintainable site. The functionality is divided to modules / methods, which support auto testing.
  3. Allows you to maintain a high level of security of data access during the entire site’s lifetime.
  4. Add new developers to your projects! You don’t need to create a complicated environment for each of them, making the parallel development as easy as never.
    This is achieved by isolating the frontend and backend parts of development
  5. This technology is a future of web design, which you were waiting for so long!

--

--