Interview Q&A / React
React interview questions
Rendering, state, hooks, keys and effects, explained with small examples.
Prefer rapid revision? Practise React short interview answers →
- How do you give a prop a default value in a modern function component?
Use default values in the destructured parameters, such as function Badge({ color = 'blue' }). The default applies only when the prop is undefined, not when it is null or an empty string.
BeginnerQuick answer1 min read