Skip to content
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

Use peerDependencies for react reference #88

Closed
lukemcgregor opened this issue Mar 11, 2015 · 5 comments · Fixed by #116
Closed

Use peerDependencies for react reference #88

lukemcgregor opened this issue Mar 11, 2015 · 5 comments · Fixed by #116

Comments

@lukemcgregor
Copy link

This means that it will use the version of react referenced by the application. Using different versions causes explode.

article about this here: http://stackoverflow.com/questions/27153166/typeerror-when-using-react-cannot-read-property-firstchild-of-undefined

@mattdell
Copy link
Contributor

Yes please. I've been getting this for the past few hours and just narrowed it down to this.

@JedWatson
Copy link
Owner

Thanks for the link to that SO answer; it explains why everyone's opening "make React a peerDependency" issues in my projects.

As far as I can tell, peerDependencies is not a valid solution for this package. React-select requires react to function as a standalone component, for testing, examples and build. Listing it as both a peerDependency and devDependency may work...

However it's just as valid to specify "react": ">=0.12.0" in dependencies; either you have a compatible version (in which case everything is fine), or you don't in which case either your two reacts explode, or you outright won't be able to npm install because npm will block you based on the invalid peer dependency. Until React figures out a way to detect & warn you in the case where you have two instances loaded, neither of the outcomes are great, but for now (0.12 and 0.13) fixing the dependency version will work just fine.

@JedWatson
Copy link
Owner

Updating the dependency seems to have resolved the issue, let me know if it still causes any troubles.

@ahutchings
Copy link
Contributor

I believe this issue should be reopened. Declaring react as a dependency rather than a peerdep causes multiple copies of react to be loaded - I believe this is the cause of issue #112. react-router uses the strategy of declaring react as both a peerDependency and a devDependency for testing (remix-run/react-router#98).

@JedWatson
Copy link
Owner

I've still got my reservations but have merged #88 so we'll see how it works out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants