Closed remonke closed 1 week ago
The provider components were designed so that it brings clarity to dev, and make sure all the child component received the appropriate provided context, and not merely emulating React.
Also, some provider has functionalities other than just "provide" the context. Do check out
and
But I don't understand why this couldn't be simply extracted to a function. These components don't render anything.
Could you share on what do you mean by function?
The Provider
component is needed for components. If you are referring to ConfigProvider
, that's different case.
Describe the feature
I suggest using functions to provide contexts instead of components. While provider components are common in React, I believe Vue's distinctive features should be embraced rather than emulating React. This approach reduces nesting and enables usage beyond templates. Provider components will remain, serving as wrappers for these provider functions. The syntax could be as follows:
Instead of:
Additional information