I'm trying to create a Form component in Sveltejs.
This Form component will use <slot /> to let his parent (App.svelte) define which Inputs and Buttons should be inside the Form.
The Inputs and Buttons are components too and once the Input component's value changes I'd like to update an object inside the parent Form component and when Button is clicked I'd like to send data back to the App component.
I've tried to read Svelte documentation and solve this problem playing around with <slot let:name={value}> but I can't find a way to update Form component when an Input component's value changes.
This is the structure of what I'm trying to do:
App.svelte
...
<Form on:submit={saveReceivedData}>
<Input name="..." value="..." />
<Button />
</Form>
...
Form.svelte
<script>
...
let data = {}
</script>
...
<form>
<slot />
</form>
...
Input.svelte
...
<input name={name} value={value} on:input={updateDataVariableOnFormComponent} />
...
Button.svelte
...
<button on:click={sendDataVariableToAppComponent}>Send</button>
...
I can try to send you a full code if needed. But, since my problem is not "what I'n doing wrong?" but "how can I do this?", I prefer to write my question in an abstract way.