Skip to content
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

Radix themes with Astro #528

Open
thebrownfox opened this issue Jun 14, 2024 · 3 comments
Open

Radix themes with Astro #528

thebrownfox opened this issue Jun 14, 2024 · 3 comments
Labels
ecosystem Incompatibility with something else

Comments

@thebrownfox
Copy link

With some components I get useThemeContext must be used within a Theme.

Here's reproducible example: https://stackblitz.com/edit/github-uiu4in?file=src%2Fpages%2Findex.astro

@thebrownfox
Copy link
Author

For future reference, it's how astro works. You cannot use react context within multiple astro islands.

When building an Astro website with islands architecture / partial hydration, you may have run into this problem: I want to share state between my components.

UI frameworks like React or Vue may encourage “context” providers for other components to consume. But when partially hydrating components within Astro or Markdown, you can’t use these context wrappers.

Astro recommends a different solution for shared client-side storage: Nano Stores.

https://docs.astro.build/en/recipes/sharing-state-islands/

@vladmoroz
Copy link
Contributor

@thebrownfox are you saying features that rely on Theme context won't work in Astro? Not sure I'm seeing a workaround there

@vladmoroz vladmoroz added the ecosystem Incompatibility with something else label Jun 17, 2024
@thebrownfox
Copy link
Author

@thebrownfox are you saying features that rely on Theme context won't work in Astro? Not sure I'm seeing a workaround there

Yes. I can see there could be some workarounds.

  1. framework level - there'd be some abstraction that would allow sharing state on higher level
  2. nested theme elements using one state for configuration (wrapping every component that needs the context, which is not pretty)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecosystem Incompatibility with something else
Projects
None yet
Development

No branches or pull requests

2 participants