Open scott-ln opened 3 years ago
I was looking for the docs on how to use defaultProps and found the PropTypes docs.
The first result on the docs search links to "Declaring Default Props" which seems like the desired result. Only the second result links to PropTypes docs but to a fragment way below the yellow warning.
I don't know how we would make it more obvious that PropTypes
is not the same as defaultProps
.
This is how I found the page, rather than the docs search:
For me the note is placed too prominently, I would have put it under the third paragraph ("PropTypes exports a range..."). I'm really used to getting old docs from search results and following redirections to newer versions, which is frequently what that top space is used for - which is why I interpreted it that way at first glance.
Either way, about the text, I would change it to:
Note for users of React.PropTypes before React v15.5: React.PropTypes has moved into a different package. Please use the
prop-types
library instead.
That would make it clear to learners that they can continue reading rather than having to act on it.
These sentences seem the same to me. I don't follow what you changed or how this is clearer (apart from "it seems clearer to me personally"). The feedback is still appreciated though.
Thanks - I'm just trying to be clear for people who've never encountered it before that this note doesn't apply to them, you know? As a newb, this is how I read the existing notice:
If it had said "Note for users of React.PropTypes before React v15.5", I would have known it wasn't talking to me. I guess the last sentence could be "If you're still using it, please use the prop-types library instead". That conditional makes it unambiguous.
Hello, it's me again. That was my old work account and Reasons prevented my submitting a PR for your consideration. I have now.
As noted in a comment on that PR, I completely had the wrong end of the stick here, please ignore everything I said above. I can't close this issue myself so if someone please could - thanks!
I was looking for the docs on how to use
defaultProps
and found the PropTypes docs. The first thing I saw there was the yellow box at the top that says:I read this as meaning "this page is out of date, please see those docs", especially because the yellow box looks so important, and went to that package, which has much less comprehensive documentation. (Including no mention of
defaultProps
currently, although that's going to be fixed.) I didn't understand until re-reading it the next day that it was intended for people using PropTypes under its old name and I was supposed to carry on reading the page.I suspect that I may not be the only learner prone to this kind of misreading, so may I please suggest that you move the note to a little further down the page and possibly tweak the wording? Thank you.