Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • React Tutorial
  • React Exercise
  • React Basic Concepts
  • React Components
  • React Props
  • React Hooks
  • React Router
  • React Advanced
  • React Examples
  • React Interview Questions
  • React Projects
  • Next.js Tutorial
  • React Bootstrap
  • React Material UI
  • React Ant Design
  • React Desktop
  • React Rebass
  • React Blueprint
  • JavaScript
  • Web Technology
Open In App
Next Article:
What is the use of React.createElement ?
Next article icon

What are the features of ReactJS ?

Last Updated : 14 Dec, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

Created by Facebook, ReactJS is a JavaScript library designed for crafting dynamic and interactive applications, elevating UI/UX for web and mobile platforms. Operating as an open-source, component-based front-end library, React is dedicated to UI design and streamlines code debugging by employing a component-oriented approach.

We will discuss about the following featured of React:

Table of Content

  • JSX(JavaScript Syntax Extension):
  • Virtual DOM:
  • One-way Data Binding:
  • Performance:
  • Extension:
  • Conditional Statements:
  • Components:
  • Simplicity:

Let’s understand each of them in detail:

1. JSX(JavaScript Syntax Extension):

JSX is a combination of HTML and JavaScript. You can embed JavaScript objects inside the HTML elements. JSX is not supported by the browsers, as a result, Babel compiler transcompile the code into JavaScript code. JSX makes codes easy and understandable. It is easy to learn if you know HTML and JavaScript.

const name="GeekforGeeks";
const ele = <h1>Welcome to {name}</h1>;

2. Virtual DOM:

DOM stands for Document Object Model. It is the most important part of the web as it divides into modules and executes the code. Usually, JavaScript Frameworks updates the whole DOM at once, which makes the web application slow. But react uses virtual DOM which is an exact copy of real DOM. Whenever there is a modification in the web application, the whole virtual DOM is updated first and finds the difference between real DOM and Virtual DOM.

 In the above-shown figure, when the whole virtual DOM has updated there is a change in the child components. So, now DOM finds the difference and updates only the changed part.

3. One-way Data Binding:

One-way data binding, the name itself says that it is a one-direction flow. The data in react flows only in one direction i.e. the data is transferred from top to bottom i.e. from parent components to child components. The properties(props) in the child component cannot return the data to its parent component but it can have communication with the parent components to modify the states according to the provided inputs.

One-way Data Binding

As shown in the above diagram, data can flow only from top to bottom.

4. Performance:

As we discussed earlier, react uses virtual DOM and updates only the modified parts. So , this makes the DOM to run faster. DOM executes in memory so we can create separate components which makes the DOM run faster.

5. Extension:

React has many extensions that we can use to create full-fledged UI applications. It supports mobile app development and provides server-side rendering. React is extended with Flux, Redux, React Native, etc. which helps us to create good-looking UI.

6. Conditional Statements:

JSX allows us to write conditional statements. The data in the browser is displayed according to the conditions provided inside the JSX.

Syntax:

const age = 12;
if (age >= 10)
{
<p> Greater than { age } </p>;
}
else
{
<p> { age } </p>;
}

7. Components:

React.js divides the web page into multiple components as it is component-based. Each component is a part of the UI design which has its own logic and design as shown in the below image. So the component logic which is written in JavaScript makes it easy and run faster and can be reusable.

Multiple components

8. Simplicity:

React.js is a component-based which makes the code reusable and React.js uses JSX which is a combination of HTML and JavaScript. This makes code easy to understand and easy to debug and has less code.

Steps to Create React Application:

Step 1: Create a react application by using the following command:

npx create-react-app foldername

Step 2: Change your directory to the newly created folder.

cd foldername

Project Structure:

Example: This example uses props data to demonstrate condiotional rendering in react

JavaScript
// Filename - index.js  import React from 'react'; import ReactDOM from 'react-dom'; import App from './App';   ReactDOM.render(<App isPass={true} />,     document.getElementById('root')); 
JavaScript
// Filename - App.js  import PassMessage from "./PassMessage"; import FailMessage from "./FailMessage";  function App(props) {     const isPass = props.isPass;     if (isPass) {         return <PassMessage />;     }     return <FailMessage />; }  export default App; 
JavaScript
// Filename - PassMessage.js  import React from "react";  function PassMessage() {     return (         <div>             <h1                 style={{                     textAlign: "center",                     color: "green",                 }}             >                 {" "}                 Congratulations!!!You passed the test.{" "}             </h1>         </div>     ); }  export default PassMessage; 
JavaScript
// Filename - FailMessage.js  import React from "react";  function FailMessage() {     return (         <div>             <h1                 style={{                     textAlign: "center",                     color: "green",                 }}             >                 {" "}                 You failed the test.Better luck next                 time..!!{" "}             </h1>         </div>     ); }  export default FailMessage; 

Step to Run the application: Open the terminal and type the following command.

npm start

Output: If you give the value of isPass={true} in index.js, then it will give the following output:

If the value of isPass={false} in index.js, then the following output is displayed.


Next Article
What is the use of React.createElement ?
author
harikatalari08
Improve
Article Tags :
  • Web Technologies
  • ReactJS
  • Web technologies
  • React-Questions

Similar Reads

  • What are the advantages of React.js ?
    React.js is a popular JavaScript library used for building dynamic and interactive user interfaces. It has become a go-to tool for developers due to its efficient architecture, high performance, and ease of use. This article highlights the key advantages of using React.js for web development and exp
    5 min read
  • What are the limitations of React.js ?
    React.js is a widely used JavaScript library for building Interactive UI with reusable components, and it has proven to be powerful and flexible. It has so many simple and efficient features. We’ve known the major pros of using React, from its reusable components and high-performance capabilities to
    3 min read
  • What are synthetic events in ReactJS ?
    In order to work as a cross-browser application, React has created a wrapper same as the native browser in order to avoid creating multiple implementations for multiple methods for multiple browsers, creating common names for all events across browsers. PrerequisitesJavaScript & DOM manupulation
    3 min read
  • What is the use of React.createElement ?
    React.createElement is a fundamental method of React JS. The main use of React.createElement is the Creation of a React component. It is the JavaScript format for creating react components. Also, the JSX react component when transpired invokes this only method for creating the component. Syntax:Reac
    2 min read
  • What are the 3 core concepts of React Redux ?
    Redux is a widely-used state management library that helps in managing the state in our projects. However, it comes with its own terminologies and jargon that can be confusing for beginners. Essentially, Redux comprises of three core concepts: actions, reducers, and store. In this article, we will c
    4 min read
  • What are the advantages of using JSX in ReactJS ?
    JavaScript XML or JSX is an extension of the JavaScript language syntax. The React library is an extension to write XML-like code for elements and components. JSX tags have a tag name, attributes, and children.  Although JSX is not a necessity to write React applications, it is extremely beneficial
    2 min read
  • What are middlewares in React Redux ?
    In React Redux, middlewares are an essential concept for handling side effects and enhancing the functionality of Redux. They are used to intercept actions sent to the Redux store and modify them before they reach the reducer or after they are dispatched. Understanding ReduxBefore diving into middle
    5 min read
  • What are props in React Native ?
    Props are used to provide properties to the components using which they can be modified and customized. These properties are passed to the components when the component is created. Props are used in both user-defined and default components to extend their functionality. These props are immutable and
    5 min read
  • What are queries in React Testing Library ?
    In this article, we explain the concept of queries in the React Testing Library. Ensuring that components behave as expected when developing applications with React is crucial. One powerful tool for testing React components is the React Testing Library. At the heart of the React Testing Library lies
    3 min read
  • React 19 : New Features and Updates
    React 19 is officially released on April 25, 2024, marking a significant milestone. This release brings various new features and improvements to enhance developer experience and application performance. Many experimental features in React 18 are now considered stable in React 19, offering a more rob
    13 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences