diff options
author | 2022-07-11 15:42:10 -0400 | |
---|---|---|
committer | 2022-07-11 15:42:10 -0400 | |
commit | faf3f3a8d111b543c0aca12432fe1a2ee5e2d726 (patch) | |
tree | a754bd03b9db417a5dfeb1a4a50236b858884ec1 /examples/with-nanostores/src/components/CartFlyoutToggle.tsx | |
parent | bf5d1cc1e71da38a14658c615e9481f2145cc6e7 (diff) | |
download | astro-faf3f3a8d111b543c0aca12432fe1a2ee5e2d726.tar.gz astro-faf3f3a8d111b543c0aca12432fe1a2ee5e2d726.tar.zst astro-faf3f3a8d111b543c0aca12432fe1a2ee5e2d726.zip |
Update `with-nanostores` example to match docs walkthrough (#3840)
* feat: replace with-nanostores with new example
* docs: update README with docs call-out
* chore: small formatting inconsistencies
* nit: standardize to spaces :'(
* nit: standardize to tabs!
* refactor: use html "hidden" property
* nit: beta.66 for sanity
Diffstat (limited to 'examples/with-nanostores/src/components/CartFlyoutToggle.tsx')
-rw-r--r-- | examples/with-nanostores/src/components/CartFlyoutToggle.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/with-nanostores/src/components/CartFlyoutToggle.tsx b/examples/with-nanostores/src/components/CartFlyoutToggle.tsx new file mode 100644 index 000000000..9c94bc831 --- /dev/null +++ b/examples/with-nanostores/src/components/CartFlyoutToggle.tsx @@ -0,0 +1,10 @@ +import { useStore } from '@nanostores/preact'; +import { isCartOpen } from '../cartStore'; + + +export default function CartFlyoutToggle() { + const $isCartOpen = useStore(isCartOpen); + return ( + <button onClick={() => isCartOpen.set(!$isCartOpen)}>Cart</button> + ) +} |