What are React Components?
Instruction: Explain what components are in React and how they are used.
Context: This question tests the candidate's grasp of the fundamental building blocks of React applications and their role in creating user interfaces.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
A React component is a reusable definition of part of a user interface. A function component accepts props and returns renderable React content, commonly expressed with JSX. Rendering the same definition more than once can create independent component instances and state.
export default function Button({ label, onClick, disabled = false }) { return <button type="button" disabled={disabled} onClick={onClick}>{label}</button>; }...