When component props defaults to true?
- When the prop is undefined
- When the prop is null
- When the prop is an empty string
- When the prop is zero
In React, a component's props will default to true if the prop value is undefined. This can happen if the prop is not passed explicitly in the component declaration or if it is explicitly set to undefined in the parent component. To avoid this behavior, default values can be set for props using the defaultProps property in the component class.
Loading...