sveltejs / sites

Monorepo for the sites in the Svelte ecosystem
https://svelte.dev
MIT License
286 stars 123 forks source link

Improve the component-binding example #519

Open Pacheco95 opened 12 months ago

Pacheco95 commented 12 months ago

I searched the repo for the example file to make a PR but found nothing.

Example: https://svelte.dev/examples/component-bindings

Keypad.svelte


<script>
import { createEventDispatcher } from 'svelte';
export let value = '';

const dispatch = createEventDispatcher();

const select = (num) => () => (value += num);
const clear = () => (value = '');
const submit = () => dispatch('submit');

{#each Array(9) as _, i} {/each}
geoffrich commented 12 months ago

The code is in the svelte repo: https://github.com/sveltejs/svelte/blob/master/documentation/examples/05-bindings/12-component-bindings/Keypad.svelte

Pacheco95 commented 12 months ago

Thanks @geoffrich Here's the PR https://github.com/sveltejs/svelte/pull/8931