Comments (5)
I think the main difference is the user tends to know which version of React they need, but might not care about prop-types
. So letting the user choose with react
seems more important. Since peer dependencies are generally a pain, it would be great to reduce the reliance on them, and this seems like a case where it could work.
But I agree the distinction is fuzzy.
from prop-types.
Well the other thing no one's mentioned here is if various components depend on incompatible versions of prop-types
, it's not a problem, because each can independently use the version it needs, whereas everything has to be using the same version (i.e. actual runtime instance) of React.
from prop-types.
Thanks for the explanation @gaearon. Would you suggest that libraries should bundle prop-types
or reference it (as they do with React) ?
from prop-types.
Thanks for the explanation; perhaps some version could make it to the README. I think the key thing to understand is that prop-types
will still be bundled during the user app's compile step, not the library's; though unlike with react
it's unnecessary that the user app explicitly depend on prop-types
.
from prop-types.
with a monorepo setup, where a lot of packages from the monorepo are going to be used across consumers, we have figured that it makes sense to just add it as a peer dependency instead of a dependency. I mean, it could very well be a dependency sure, but it just makes sense to treat it as other dependencies
from prop-types.
Related Issues (20)
- `.elementType` incompatible with `React.ElementType` HOT 5
- Latest version of prop-types is having vulenrability.Any idea that which safer version shall I switch to? HOT 2
- v15.8.0 breaks `PropTypes.shape({...})` for objects and class-instances. HOT 11
- 15.8.0: `checkPropTypes` sometimes throws: Cannot read properties of undefined (reading 'hasOwnProperty') HOT 11
- Children required prop-types fire warning on create HOT 5
- Update to @babel/preset-react7.10.1 HOT 3
- _propTypes.default.shapeOf is not a function HOT 1
- Potential isRequired bug in v15.8.0 and above HOT 10
- TypeError: Cannot destructure property 'checkPropTypes' as it is undefined. HOT 2
- error (checkPropTypes is not a function) while using with sveltekit HOT 1
- Accidental issue creation, apologies
- Failed prop type: Converting circular structure to JSON when stringifying React jsx HOT 6
- Conditional prop for value another prop HOT 2
- Error : `_propTypes2.default.oneOfType is not a function` HOT 2
- `oneOfType()` does not seem to allow all types specified HOT 2
- SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED HOT 1
- Importing a reference to PropTypes as opposed Proptypes directly HOT 4
- List transitive failures on failure of oneOfType
- The `prop-types` package import is not suddenly recognized when running jest HOT 6
- Update prop-types Version | Severity: high HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prop-types.