Lock: React 16 and Peer Dependency

Created on 1 Aug 2017  ยท  5Comments  ยท  Source: auth0/lock

Hi,

React 16 beta is now available (in beta), I can see your update in the package.json to support it.

However I am getting multiple installs of react due to the order of dep (15 > 16) and this package being installed as a dep rather than a peer-dep. Could this be changed please?

yarn list v0.27.5
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ””โ”€ [email protected]

This is a follow on from this issue (also note geaeron's response)
https://github.com/facebook/react/issues/8026

Included error reported from this issue:

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).

Regards,
Mark.

All 5 comments

We can't use react as a peer dependency because you can use lock without having react in your project. We support v16, why isn't yarn just downloading a single version?

Ah, I understand.

It is a good question. I removed node_modules and did another yarn install. Still I get this:

yarn list v0.27.5
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ””โ”€ [email protected]

Maybe it's having trouble matching with the -beta.2 postfix.

Mark.

Do you have two reacts in your node_modules folder?

Yes, verified:

./node_modules/react (v16)
./node_modules/auth0-lock/react (v15)

maybe it's the beta flag then.. I really don't know. You should ask this to the yarn team to see how they resolve deps in this case. In any case, we can't add react as a peer dependency. I hope you understand ๐ŸŽ‰

Was this page helpful?
0 / 5 - 0 ratings