JavaScript React Components React Component Patterns React Component Patterns Review

Brunhilde Vink
Brunhilde Vink
9,102 Points

Bummer! 'PropTypes' is incorrect

const Book = (props) => {
  return ( ... );
}

Book.PropTypes = {
 ...
};

1 Answer

Steven Parker
Steven Parker
171,904 Points

That's not the correct answer. Remember that identifiers in JavaScript are case-sensitive, so "PropTypes" is not the same thing as "propTypes".

Brunhilde Vink
Brunhilde Vink
9,102 Points

But we learned in the React course to use PropTypes instead of propTypes? I'm a bit confused because I indeed tried using propTypes in my latest projects but that gives me errors..

Steven Parker
Steven Parker
171,904 Points

Both identifiers are used, but for different things. You can see an example about 3 minutes into the Validate Props with PropTypes video on code lines 14 and 15.