← React Intermediate Questions - Set 10 Q95

What is the purpose of the `defaultProps` property in React?

React Intermediate Questions - Set 10

Example

function Badge({ tone = 'neutral' }) { … }   // modern
Badge.defaultProps = { tone: 'neutral' };   // legacy, warns in React 19

What to notice

← Back to the question list