GithubHelp home page GithubHelp logo

Comments (5)

gaearon avatar gaearon commented on May 4, 2024 14

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.

jedwards1211 avatar jedwards1211 commented on May 4, 2024 4

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.

pgn-vole avatar pgn-vole commented on May 4, 2024 1

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.

benwiley4000 avatar benwiley4000 commented on May 4, 2024

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.

gaurav5430 avatar gaurav5430 commented on May 4, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.