What is a React component?
Answer
A React component is a reusable, self-contained piece of UI. Components are the fundamental building blocks of React applications — you compose them together to build complex interfaces. Modern React uses function components: plain JavaScript functions that accept props as an argument and return JSX: function Welcome({ name }) { return <h1>Hello, {name}!</h1>; }. Class components (legacy): extend React.Component and implement a render() method. Components must start with an uppercase letter so React knows to treat them as components rather than plain HTML elements. Components can contain other components (composition), manage their own state with hooks, and receive data from parents via props. The component tree forms the structure of your application. There is no hard rule for how large a component should be — generally, a component should do one thing well. Components promote code reuse, separation of concerns, and easier testing.