Introduction

What is react and react-dom React is an open-source JavaScript library for building user interfaces (UIs). It was developed and is maintained by Meta, and is widely used by developers to create interactive and dynamic web applications. React is a library for building user interfaces. The package react contains only the renderer-agnostic code i.e. the core React library, algorithm for computing changes in the UI and other helpers. The package react-dom contains the code specific to the DOM rendering of React components....

August 30, 2024 · 4 min

The Foundation

What is JSX? A syntax extension for JavaScript used in React. It allows developers to write HTML-like code inside JavaScript files, making it easier to visualize the structure of the user interface. JSX is not valid JavaScript, so it needs to be transformed into regular JavaScript (usually using Babel) before it can be understood by browsers. How Does the JS Engine Understand JSX? Since JSX is not standard JavaScript, browsers and JavaScript engines cannot understand it directly....

August 29, 2024 · 4 min

More React Jargons

What is the Difference Between .js and .jsx Files? .js Files Typically used for standard JavaScript files. In the context of React, these files can also include React components written in JavaScript, but without the explicit use of JSX syntax. They can contain plain JavaScript, ES6+, and sometimes React code if JSX is not being used. .jsx Files files specifically indicate that the file contains JSX syntax, which is an extension of JavaScript used in React to describe the UI structure in a syntax that looks similar to HTML....

August 28, 2024 · 4 min

Architecture and Rendering

Monolith Architecture A traditional software architecture pattern where an entire application is built as a single, unified unit. All components (like the user interface, business logic, and data access layers) are tightly coupled and run as a single service. While simpler to develop and deploy, monoliths can become difficult to maintain and scale as the application grows, because changes to one part of the system can affect the entire application....

August 27, 2024 · 3 min

React Routing

React Router see the official documentation for latest updates. react-router-dom A library for routing in React applications, allowing you to define routes and navigation between different components based on the URL. It enables the creation of single-page applications (SPAs) where the UI updates without refreshing the entire page. Configuring react-router-dom To configure routing in a React application, you typically wrap your application in the BrowserRouter component and define routes using the Routes and Route components....

August 26, 2024 · 3 min

The Class Components

What is a Class-Based Component (CBC)? In React, a Class-Based Component (CBC) is a component defined using ES6 classes, inheriting from React.Component. CBCs are the traditional way to create stateful components and manage component life cycles. Although functional components with hooks are more popular now, CBCs are still used in many existing React applications. class MyComponent extends React.Component { render() { return <div>Hello, World!</div>; } } How to Use Props in CBC Props in a CBC are accessed using this....

August 25, 2024 · 6 min

Optimization

1. Single Responsibility Principle & Modularity Principle The SRP is a fundamental design principle in software development that states that a class, module, or function should have one and only one reason to change. In other words, it should have only one responsibility or job. This makes the code easier to maintain, test, and extend. A class that handles both user authentication and data validation violates SRP. These two tasks should be separated into different classes....

August 24, 2024 · 3 min