Sobes.tech
Middle

What is Props in React?

sobes.tech AI

Answer from AI

Props (short for "properties") in React are input parameters passed to components to configure their behavior and display. They make components reusable and dynamic.

Props are passed from a parent component to a child and are immutable within the child component.

Example:

function Greeting(props) {
  return <h1>Hello, {props.name}!</h1>;
}

// Usage
<Greeting name="Alexey" />

In this example, the Greeting component receives a prop called name and displays it.