Skip to content

Use inject/provide in functionnal components #7521

Discussion options

You must be logged in to vote

I was under the impression that both syntax should be strictly equal. Is this caused by this section of the documentation?

The second variant does not create a functional component. it's a shortcut to creating a normal component, but passing just the setup function. That's why it works - it creates a stateful component.

If so I think it should be noted more clearly that functionnal component have such limitations in the documation.

We are open to suggestions in the core docs repository.

As to why it doe not work: As functional components can't have (reactive) state, they only re-render when their props change (passed in by the re-rendering parent component. As inject() is not props, b…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@CapitaineToinon
Comment options

Answer selected by CapitaineToinon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants