default prop value
A value a component uses for a prop when the caller leaves that prop out.
In more detail
In function components you set it with JavaScript destructuring defaults, as in function Box({ variant = "primary" }). The older defaultProps field is not supported on function components in React 19. The default applies only when the prop is missing or undefined, not when it is null.
Related terms
- destructuring — JavaScript syntax that unpacks values from an object or array into separate named variables in one step.
- prop — An input passed to a React component, written like an HTML attribute, such as size="lg" in <Button size="lg">.
Taught in
- Props Contract: Immutability, Children, And Polymorphic Tags — React 19 & Modern Component Architecture