🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEreact

react Documentation

LOADING ENGINE...

React Components

Master React components, hooks, and best practices.

Components

Author

Pascual Vila

Frontend Instructor.

In React, the user interface is built using components. A component is an independent and reusable part of the UI. Components can be both functions and classes, but the modern trend is to use functional components.

Types of Components:

  • Functional Components: These are JavaScript functions that return JSX elements.
  • Class Components: These are ES6 classes that extend from React.Component.

Example of a Functional Component:

              {`import React from "react";
      
              function MyComponent() {
                return <h1>Hello, World!</h1>;
              }
      
              export default MyComponent;`}