← BYTES
React.js·Starter·Ref: 4.1.17
If a component is rendered as `<Greeting />` with no attributes, and it expects a `name` prop, what is `props.name` inside it (assuming no default is specified)?
Have a question about this video? Mention reference 4.1.17 when you contact us.
a.An empty string `""`
b.`undefined`
c.The literal string `"undefined"`
d.React throws an error immediately and refuses to render
Props that aren't passed are simply `undefined`, just like any missing property on a plain JavaScript object -- React doesn't substitute an empty string or throw by default; you'd use a default parameter or `defaultProps` if you want a fallback value.
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES4117#Reactjs