webcomponents / react-integration

Converts web components into React components so that you can use them as first class citizens in your React components.
MIT License
306 stars 31 forks source link

Context doesn't get passed through #11

Open jpnelson opened 8 years ago

jpnelson commented 8 years ago

Breaks for things such as https://github.com/yahoo/react-intl

marcodejongh commented 8 years ago

😢

jpnelson commented 8 years ago

@marcodejongh There's a workaround for the portals method that I spiked, but it's a bit hacky – React doesn't want to be able to expose context to anything except through direct dependency, so you need to get the internal data.

@treshugart is working on a pull request that will not use portals at all – it will rely on our shadow DOM polyfill. This will be fine as long as we don't move entire elements in the DOM, which is the plan for future components.

treshugart commented 8 years ago

As far as react is concerned, we can still move entire elements, so long as it's part of the shadow DOM. Though, if we did that, then it's no longer part of the Shadow DOM and hard for us to control it's rendering so I doubt we'll do that at all in the future.

treshugart commented 8 years ago

Isn't context an experimental feature, though? From Reacts website:

Context is an advanced and experimental feature. The API is likely to change in future releases.

treshugart commented 8 years ago

This may be fixed by #18 but we should write a test for it to be sure.