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

[RFR] Remove bad advice about npm link #27

Merged
merged 1 commit into from
Sep 9, 2016
Merged

[RFR] Remove bad advice about npm link #27

merged 1 commit into from
Sep 9, 2016

Conversation

fzaninotto
Copy link
Member

Using npm link creates two versions or React, and causes the dreadful error:

Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

@fzaninotto
Copy link
Member Author

Closes #26

@djhi djhi merged commit bd614ac into master Sep 9, 2016
@djhi djhi deleted the npm_unlink branch September 9, 2016 06:54
@nonotest
Copy link
Contributor

Hello,
If someone does need to link against a local version, you can bypass the addComponentAsRefTo error like this:

# link the component
cd my-app
npm link ../my-react-component

# link its copy of React back to the app's React
cd ../my-react-component
npm link ../my-app/node_modules/react

source: http://stackoverflow.com/questions/31169760/how-to-avoid-react-loading-twice-with-webpack-when-developing

I think it might be useful to re-add that bit in the doc.

@fzaninotto
Copy link
Member Author

I think it's out of the admin-on-rest scope, so we won't add it back to the doc. But thanks for the pointer!

alanpoulain pushed a commit to alanpoulain/react-admin that referenced this pull request Nov 22, 2018
Removal of duplicated list items.
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 this pull request may close these issues.

3 participants