title: Blazor Child Component how to update parent component
body: <p>I am hoping that someone can help me. I am trying to learn Blazor and I am creating an example site to create a shopping list. I am having issues updating the list items as I am unable to pass the items back from the Child Component to the parent component to then pass to the API call. From the update button I can hit the UpdateItem method but I am not sure how to pass the bound items from the three inputs.</p>
  <pre><code>&lt;ListTemplate Loader=&quot;@GetShopping&quot; ListGroupClass=&quot;orders-list&quot;&gt;
      &lt;Loading&gt;Loading...&lt;/Loading&gt;
      &lt;Empty&gt;Empty.......&lt;/Empty&gt;
      &lt;Item Context=&quot;item&quot;&gt;
          &lt;input @bind=&quot;item.Id&quot; /&gt;
          &lt;input type=&quot;checkbox&quot; @bind=&quot;item.IsDone&quot; /&gt;
          &lt;input @bind=&quot;item.Item&quot; /&gt;
          &lt;button @onclick=&quot;UpdateItem&quot;&gt;Update&lt;/button&gt;
      &lt;/Item&gt;
      &lt;AddNew&gt;
          &lt;input placeholder=&quot;Something todo&quot; @bind=&quot;newToDo&quot; /&gt;
          &lt;button @onclick=&quot;AddTodo&quot;&gt;Add Todo&lt;/button&gt;
      &lt;/AddNew&gt;
  &lt;/ListTemplate&gt;
  </code></pre>
  <p>ListTemplate class
  @typeparam TItem</p>
  <pre><code>@if (items == null)
  {
      @Loading 
  }
  else if (!items.Any())
  {
      @Empty 
  }
  else
  {
      &lt;div class=&quot;list-group @ListGroupClass&quot;&gt;
          @foreach (var item in items)
          {
              &lt;div class=&quot;list-group-item&quot;&gt;
                  @Item(item) 
              &lt;/div&gt;
          }
          @AddNew
      &lt;/div&gt;}
  
  @code 
  { 
      IEnumerable&lt;TItem&gt; items;
  
      [Parameter] public Func&lt;Task&lt;IEnumerable&lt;TItem&gt;&gt;&gt; Loader { get; set; }
      [Parameter] public RenderFragment Loading { get; set; }
      [Parameter] public RenderFragment Empty { get; set; }
      [Parameter] public RenderFragment AddNew { get; set; }
      [Parameter] public RenderFragment&lt;TItem&gt; Item { get; set; }
      [Parameter] public string ListGroupClass { get; set; }
  
      protected override async Task OnParametersSetAsync()
      {
          items = await Loader();
      }
  }
  </code></pre>