You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a component that is composed by many children components, all of which use one particular injection key, provided by this parent component. It just so happens that I don't want all children to read from the same provided value, but instead be able to provide a value to be injected in only one child component, for example. I tried to implement a simple Provider component that outputs the default slot and provides whatever is in the prop, but this doesn't work.
Also, I can't use props for the same reason why provide/inject exists: to avoid prop drilling, as those child components have a long chain of children components themselves.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a component that is composed by many children components, all of which use one particular injection key, provided by this parent component. It just so happens that I don't want all children to read from the same provided value, but instead be able to provide a value to be injected in only one child component, for example. I tried to implement a simple
Provider
component that outputs the default slot and provides whatever is in the prop, but this doesn't work.Also, I can't use props for the same reason why provide/inject exists: to avoid prop drilling, as those child components have a long chain of children components themselves.
Beta Was this translation helpful? Give feedback.
All reactions