Components

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;`}