diff options
Diffstat (limited to 'examples/ssr/src/components')
-rw-r--r-- | examples/ssr/src/components/AddToCart.svelte | 5 | ||||
-rw-r--r-- | examples/ssr/src/components/Cart.svelte | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/examples/ssr/src/components/AddToCart.svelte b/examples/ssr/src/components/AddToCart.svelte index 0f7a97a93..bae888b6b 100644 --- a/examples/ssr/src/components/AddToCart.svelte +++ b/examples/ssr/src/components/AddToCart.svelte @@ -1,7 +1,6 @@ <script> import { addToUserCart } from '../api'; - export let id = 0; - export let name = ''; + let { id, name } = $props() function notifyCartItem(id) { window.dispatchEvent(new CustomEvent('add-to-cart', { @@ -49,6 +48,6 @@ button:hover { text-transform: uppercase; } </style> -<button on:click={addToCart}> +<button click={addToCart}> <span class="pretext">Add to cart</span> </button> diff --git a/examples/ssr/src/components/Cart.svelte b/examples/ssr/src/components/Cart.svelte index 74db0bc79..5d4b7d251 100644 --- a/examples/ssr/src/components/Cart.svelte +++ b/examples/ssr/src/components/Cart.svelte @@ -1,5 +1,5 @@ <script> - export let count = 0; + let { count } = $props() let items = new Set(); function onAddToCart(ev) { @@ -27,7 +27,7 @@ font-size: 24px; } </style> -<svelte:window on:add-to-cart={onAddToCart}/> +<svelte:window onadd-to-cart={onAddToCart}/> <a href="/cart" class="cart"> <span class="material-icons cart-icon">shopping_cart</span> <span class="count">{count}</span> |