arrow_backBACK TO DRILLS
Blue BeltarchitecturePREMIUM
defaultProps Deprecated in React 18 - Use Destructured Default Parameters Instead
A function component in a React 18 codebase is written using the legacy defaultProps pattern.
REACT_MODULE // 0x42
function Badge({ label, color }) {
return <span style={{ color }}>{label}</span>;
}
Badge.defaultProps = { color: 'gray' };What is the recommended React 18 replacement for this pattern, and why?