What are props in React?

Why Interviewers Ask This

This is a classic screening question for React.js roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

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.

Common Mistake

Many candidates answer correctly but can't explain the 'why'. Always be prepared to justify your answer with a concrete example or use case from your React.js experience.