AceDevHub
Beginner React Interview QuestionsBeginnerConcept

React · Question 7

What are props in React?

Direct answer

Props are read-only inputs passed from a parent to a component to configure what that component renders or how it behaves.

Props can contain strings, numbers, objects, arrays, functions, or JSX. A component receives a snapshot of its props for each render.

Profile.jsx
function Avatar({ name, size = 48 }) {
  return <img alt={name} width={size} height={size} />;
}

export default function Profile() {
  return <Avatar name="Ada" size={64} />;
}