I have several of these which follow the same pattern.
<div class="form-control">
<label for="foo">foo</label>
<input type="text" id="foo" bind:value={foo} />
</div>
<div class="form-control">
<label for="bar">bar</label>
<input type="text" id="bar" bind:value={bar} />
</div>
I tried to create the same thing using this loop.
{#each [ foo, bar ] as v}
<div class="form-control">
<label for="{v}">{v}</label>
<input type="text" id="{v}" bind:value={v} />
</div>
{/each}
However this does not create a 2-way binding. I found that if I change either of those variables somewhere else then the changes will be reflected in the input fields. However if I type something in the input field, the variables are not updated to match. How can this be made to work? Why does the binding only work in one direction?