Why REACT ? What features does React give ?(Beginner friendly)

Why REACT ? What features does React give ?(Beginner friendly)

Table of contents

No heading

No headings in the article.

'Why React is becoming very popular?'
'What are the Advantages of React ? '
'When I should not use React ?'
'Why startups are using React?'

I will give you a start off about what is react.JS .'' React.js is a fast, scalable, and simple,open-source JavaScript library that is used for building user interfaces specifically for single-page applications. It’s used for handling the view layer for web and mobile apps. React also allows us to create reusable UI components.'' It can be used with a combination of other JavaScript libraries or frameworks, such as Angular JS in MVC.

Let's discuss React Features/Advantages in points with brief explanation :

  • React is Declarative : React takes care of updating the DOM according to it. In simple language , you just need to decide what you want to eat in your dinner and not how to you arrange or bring ingredients while preparing your dinner . Program that are easier to read because it hides the lower level detail. In declarative programming we don't even know about the lower level details of the system.

  • JSX : You can write your HTML and JavaScript code together using JSX .We can also write in pure old JavaScript.

  • Virtual DOM (Document Object Model) : This is something awesome which ReactJS provide us rather than rendering whole DOM it just render's the components that actually change by making copy of real DOM and first checking the Virtual DOM I will not dive deep into this .

  • Complex UI’s : Since React allows us to reuse the components, it makes sense to use React, where we have complex UIs, and when a lot of pages have similar UI.

  • Simplicity : ReactJS is just simpler to grasp right away and with function components and react Hooks it makes more easy to build a professional web. The component-based approach, well-defined lifecycle, and use of just plain JavaScript make React very simple to learn.

  • Easy to learn : ReactJS need some basic understanding in HTML , CSS and JavaScript topics like closures , this , arrow function and ES6 will make it very simple to use React.

  • Native Approach : We can use React to create mobile applications (React Native).React is a diehard fan of reusability, meaning extensive code reusability is supported. So at the same time, we can make IOS, Android and Web applications.

  • Testability : ReactJS applications are super easy to test. React views can be treated as functions of the state, so we can manipulate with the state we pass to the ReactJS view and take a look at the output and triggered actions, events, functions, etc.

When not to use ReactJS

  • Static Website with less Dynamic content : Using ReactJS for a static website that has relatively static content with very less dynamic content will be an over-kill .

  • SEO Optimized Website : Though there are some tweaks to develop SEO optimized React website, still many developers complain about the crawl ability of React websites. Also, it will be a significant risk to put SEO efforts on the React website.

How to create a React app?

There are two ways to create React apps.

  1. you use npm installed on your machine. If you’re using VS Code, you need to make sure you’ve configured your machine to run React code in VS code using npm. You will also need to setup a build environment for React that typically involved use of npm (node package manager), webpack, and Babel. (Mostly this method is used and we will see it below.)

  2. We can also create a React app without npm by directly importing Reactjs library in our HTML code. This is exactly what we will do here. Here are the steps required to create and run a React app without npm.

Let's see how to install react by 1st approach
In you VS code terminal or in cmd use: npx create-react-app my-app you can use any name you want or simply . if you dont need any folder creation . after 3-5 mins depending on your computer you will see a boiler folders and code by react Like this and now you are ready to rock!

Picture2-1.webp

This is all you need to start using React as a beginner . As this was a beginner React guide I have not covered about other Important topics related to react for more you can explore react Official website