CodeZettaInterview Hub

React · Props · Junior · Live Coding

How do default props work with function components?

Short Interview Answer

Destructure defaults in parameters: ({ size = 'md' }) => ...

Detailed Explanation

defaultProps on functions is legacy. Prefer parameter defaults and TypeScript optional props.

Did you know this answer?