I have a Svelte component that accepts a prop for handling input changes, structured as follows:
<!-- A.svelte -->
<script>
export let onChange = (value) => {};
</script>
<input
type="number"
bind:value
on:change={() => onChange(value || '')}
/>
Then, I have another component that uses this component:
<!-- B.svelte -->
<script>
export let onChange = () => {};
</script>
<p>Enter your age</p>
<A
onChange={onChange}
/>
Notice how I have to pass onChange manually up the hierarchy in addition to having to define it. Is there a way to avoid that?