-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update exported PropTypes #3205
Comments
👍 In my opinion, importing prop types from other modules seems counter-productive. If a component uses In cases where a component only passes things along to other components, it should be sufficient to define it as an object or "any". I wonder how common this is among react libraries. |
I've never seen any other React libraries that export propTypes. I've never even heard of anybody using the exported propTypes here until #3203. |
not sure how things made it into that list, but original intention was people to be able to add a |
That would make sense, but we've already extensively documented |
@rickharrison Care to elaborate? 😛 |
I do use some of them personally. My thought was why take them out if they are already there considering it's so small. But, I guess if you don't want to maintain them I see why you would. I could also easily just include a similar file like that in my own project, but I'd have to duplicate it across our many react-router based apps. |
IMHO I think most people are better served by a real typing system, such as TypeScript or Flow. PropTypes' duck typing never seemed that helpful to me, personally. Looks like we need to update our PropTypes anyways. Given they're out of date, I would say we get rid of them. |
Right, IMO the main thing is that they've just gotten quite out-of-date. Plus the types for things like locations are owned by history anyway. |
PropTypes are super valuable, but I'm not sure we need to export any of them except router |
We're not currently exporting a |
I just found a counterexample. react-intl exports a shape. As I'm currently using react-intl, I am selfishly declaring for the sake of consistency that we should do the same in React Router. I'm now in favor of continuing to export prop types, though perhaps with a slightly different API. |
Updated OP with my current thinking here. |
I'm not convinced that we get anything out of exportingPropTypes
. They're at least documented now, thanks to @lPadier's #3203, but I think we ought to consider dropping them.With the possible exception oflocation
, which is a matter of history rather than here anyway, they're not really applicable to users of this library, and things likehistory
are even deprecated.Analogous to how react-intl handles it, we should export
routerShape
as a top-level export. The other exports likelocation
, to the extent they are required, should sit inhistory
.The text was updated successfully, but these errors were encountered: