React Components

React Components

Components are the primary building blocks of any React application. A component is a self-contained, reusable piece of code that defines how a part of your user interface should appear and behave.

Function Components

The simplest and most modern way to define a component in React is to write a standard JavaScript function.

function Welcome() {
  return <h1>Hello, Welcome to React!</h1>;
}

These are known as Function Components because they are literally just JavaScript functions. They can accept inputs (called "props") and return React elements detailing what should appear on the screen.