Make UI framework contexts available between islands #742
Replies: 7 comments 4 replies
-
The same behavior happens in Solid.js with Kobalte (as I mentioned in this issue withastro/issues/9412) |
Beta Was this translation helpful? Give feedback.
-
@danspratling I think you could rename the proposal to something like "Make UI framework contexts available between islands" |
Beta Was this translation helpful? Give feedback.
-
Is there any progress? I have the same problem. |
Beta Was this translation helpful? Give feedback.
-
when i read official solution regarding this problem, I'm shocked and i thought they were just kidding, slap my face and re read again. Im not dreaming. Just read it here: https://docs.astro.build/en/recipes/sharing-state-islands/ So what they suggesting is to rebuild all popular component library like material ui, etc ourself using nano store?? all of this component library was mostly built using usecontext, even many of them just suggesting to move from Astro: |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Any API ideas? |
Beta Was this translation helpful? Give feedback.
-
If posted this in the discord, I think an API similar to this would offer a lot of flexibility.
|
Beta Was this translation helpful? Give feedback.
-
Body
Summary
Most react based UI libraries (especially headless ones) make use of linked component nesting, where the child components rely on the parent components to exist. This does not work in astro, and the correct solution to use this kind of component are very limiting.
Previous discussion
Background & Motivation
Here's one example from RadixUI, and another from HeadlessUI.
In React this structure acts like slots in Astro
The proposed solution is to create a react component that wraps these react library.
However, this is an very limiting solution that does not provide the same level of customisation as provided by the original libraries.
Issues with this approach
^ That's a lot of unnecessary duplication for an arbitrary/one-off change, but far less important than being able to pass components as children (you could argue that this duplication would happen either way).
Goals
Benefits
Beta Was this translation helpful? Give feedback.
All reactions