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

Support provide/inject on functional components that are the immediate descendant of the provider #11559

Closed
phroggyy opened this issue Aug 4, 2020 · 1 comment

Comments

@phroggyy
Copy link

phroggyy commented Aug 4, 2020

What problem does this feature solve?

This comment from #5194 covers the use case quite well. In short, there is no way to do the following:

<SomeProvider foo="bar">
    <FunctionalFoo/>
</SomeProvider>

The inner functional component cannot access any injected properties.

This occurs because the FC is rendered in the nearest vue context, which happens to be the provider in this case, and it's not possible to inject and provide within the same component.

What does the proposed API look like?

The same as now, but supporting injections in functional components that are the immediate children of a provider.

This could either be achieved by supporting injections inside the same component as the provider, or passing the injections down similar to how we pass props down.

@posva
Copy link
Member

posva commented Aug 4, 2020

Duplicate of #5837

@posva posva marked this as a duplicate of #5837 Aug 4, 2020
@posva posva closed this as completed Aug 4, 2020
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

No branches or pull requests

2 participants