What are props in React?
Answer
Props (short for properties) are the mechanism for passing data from a parent component to a child component. Props are read-only — a component should never modify its own props. Example: <Button color="blue" onClick={handleClick} label="Submit" />. Inside the Button component, props.color, props.onClick, and props.label are accessible. With destructuring: function Button({ color, onClick, label }) { ... }. Any JavaScript value can be passed as a prop: strings, numbers, booleans, arrays, objects, functions, and even other React elements. Default props: function Button({ color = "blue" }) { ... }. Prop spreading: <Component {...props} /> passes all properties of an object as props. Children prop: content between component tags is passed as props.children. Props flow unidirectionally — from parent to child (top-down) — which makes data flow predictable and easier to debug. To share data from child to parent, pass a callback function as a prop.