facebook / prop-types

Runtime type checking for React props and similar objects
MIT License
4.48k stars 356 forks source link

Document defaultProps in README #343

Closed scott-ln closed 2 years ago

scott-ln commented 3 years ago

defaultProps are not mentioned at all in the README. This is not useful if you've just gotten an error from eslint-plugin-react/require-default-props. The top Google hit for "React defaultProps" is this page on the React site which directs you to look at the prop-types documentation instead.

ljharb commented 3 years ago

A sentence that points back to https://reactjs.org/docs/typechecking-with-proptypes.html#default-prop-values seems reasonable.

scott-ln commented 3 years ago

Just looked at that page again and I see now that the message at the top which I mentioned is intended for people who were using the old React.PropTypes. That wasn't clear to me as a new user encountering an important-looking yellow box at the start of the page, so perhaps it could be moved a little further down the page.

ljharb commented 3 years ago

I have no control over react’s docs; you’d have to file an issue/PR on react itself for that.

scott-ln commented 3 years ago

Gotcha, will do - thanks Jordan.

ljharb commented 2 years ago

Closing in favor of https://github.com/reactjs/reactjs.org/issues/3632