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
Using nanostores in astro components #7936
Comments
I think that would benefit from some rewording, but they are not exactly contradicting. Explaining:
That is referring to server-side components, on Astro components that means the frontmatter: ---
// This runs on the server, not recommended
import {flag} from './stores.js';
const flagValue = flag.get();
--- A ---
---
<script>
// This runs on the client, perfectly fine
import {flag} from './stores.js';
const flagValue = flag.get();
</script> |
Good point! I should have clarified a bit more in my issue regarding the differences between using nanostores in |
Thanks for the conversation here! I wonder if something like this would address the issue? Existing:
Change to something like...
Would something like that help? If so, would someone like to make a PR to update with clearer guidance? |
I think that is a great improvement! |
📚 Subject area/topic
Nanostores
📋 Page(s) affected (or suggested, for new content)
https://docs.astro.build/en/recipes/sharing-state-islands/
https://docs.astro.build/en/recipes/sharing-state/
📋 Description of content that is out-of-date or incorrect
Currently, the docs pertaining to
sharing-state-islands
seem to advise against using nanostores in.astro
components in theFAQ
section. However, the docs forsharing-state
demonstrates setting up nanostores for use inside.astro
components with setting state/subscribing to changes.There appears to be a contradiction between the two.🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
No response
The text was updated successfully, but these errors were encountered: