Dolly Blog

Introduction

Hey guys! I've been using React for a while now, and I thought, "Why not share what I've learned?" Exciting, right? So In today’s article, we'll dive into the basics of React. We'll explore its core concepts and benefits. if you just starting out, understanding React’s component-based architecture revolutionize your approach to web development.

Prerequisites

Before diving into React, it's essential to have a solid understanding of HTML, CSS, and JavaScript. Familiarity with ES6 features, such as arrow functions, classes, and modules, is advantageous. Additionally, a grasp of the Document Object Model (DOM) and how it interacts with JavaScript will facilitate a smoother learning curve but we are still going to talk about it in this article too. Let’s dive right in 😉

What is React?

React is an open-source JavaScript library created and maintained by Facebook. It is specifically designed to make building user interfaces for websites or web applications easier and more efficient. So, instead of starting from scratch every time you want to create a part of a website that changes based on user interactions or updates, you can use React's tools to build these parts quickly and effectively.

All that we just talked about can be achieved by using a concept in React called "components." Components are like building blocks you can assemble to create your web interface. Each component represents a specific part of your page, like a button, a form, a header, or a whole section. So, you can combine these components to build complex user interfaces.

One of the challenges I faced while learning React was not conducting thorough research beforehand. I chose to learn it primarily due to its popularity and widespread use in many tech companies, without pausing to ask myself a crucial question: 'Why should I learn or use React?’

So here are the reasons you should consider using React.

Why Would You Use React?

There are many reasons you should consider using React, but we are going to be looking at a few of them that are important.

Basic Architecture of how React works?

Here is a diagram I came up with to illustrate how react works.

How react works

The way React operates involves both the Server and the Client. In this scenario, the Server can take the form of a CDN(Content Delivery Network), which serves files like an HTML document but doesn't handle computations. During communication, the CDN provides an index.html file to the Client.

Inside this index.html, there's a React file – often called bundle.js or with any preferred name – which is, in fact, a collection of JavaScript codes. However, the index.html itself appears blank; its purpose is to deliver the JavaScript file to the Client.

When this JavaScript bundle (bundle.js) is sent to the Client, it's executed by the Client's browser. This initial execution helps the Client understand how the page should look and behave. As a result, React works to manage the virtual representation of components in the browser's memory, updating the actual DOM efficiently to create a dynamic and responsive user interface. I really hope that made sense!

Conclusion

That’s all guys and congrats on getting to the end of this article 🎉 🎉. Don’t worry if everything does not click at first. As we go along in this series you’ll get a better understanding of how to use React and how it works. Have a nice weekend and see you next week 😀