-
Notifications
You must be signed in to change notification settings - Fork 12
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
Scoped slots API #8
Comments
I'm hesitant about implementing this as a protocol. Vue.js scoped slots are a framework-specific concept (please don't be confused by its usage of Standard based |
This certainly is an interesting API, though I do worry that @web-padawan is right about it needing to be framework specific. @edimitchel can you think of a starting place from which you’d want to see something like this made possible cross renderer? There seems like the possibility of a sort of three sides context API pattern here, content element messages to its parent to establish content and the parent messages the wrapping element with context to trigger updates, maybe... However, structuring that in a way that made sense in a number of different renders sound like quite the task. |
This is a scenario that I've managed quite elegantly with dependency injection for a good 15+ years on projects of all sizes. I've also built DI on top of React's context API successfully, used by a large-scale React app (>1MM LoC). I need to review the context API proposal here, but if it's similar in concept to React's then I don't foresee it being a problem to handle these scenarios without introducing an additional concept around slots. I think it's likely that a basic context api could handle this scenario, and a layered DI could provide app-specific power above it if needed, without the need to mix the concerns of UI composition with data/service location. |
I think there are two things we could reasonably do as community protocols in this space:
|
@edimitchel I wonder how you see this aligning with the discussion in #45? |
Web Components with slots permit to provide more reusable components and to write less props for more features.
BUT,
when we want some contextual data, we are lost and we have to create slots depending to initial data..
Vue introduces Scoped Slots which adds the possibility to build slot using contextual props, aka Scoped props.
See more : https://vuejs.org/v2/guide/components-slots.html#Scoped-Slots
It's possible to improve that on Web Components ?
The text was updated successfully, but these errors were encountered: