title: Blazor WASM: getting sibling components to communicate in order to update data
body: <p>I have a page component and within it a breadcrumbs component and a business data component that displays all of the businesses for that page based on a category alias it is passed through the route.</p>
  <p>Some of the breadcrumb links direct the user to another routable/page component and these work fine. However, some of them require a refresh of the business data component and it's these I'm having an issue with.</p>
  <p>I've tried creating a service with a event that the breadcrumbs component can invoke when a link is clicked and the data component can subscribe to (following <a href="https://stackoverflow.com/questions/55775060/blazor-component-refresh-parent-when-model-is-updated-from-child-component#comment112285960_55792800">this post</a>), but I can't get that to work as the return type is wrong when I try and call GetBusinesses as a result.</p>
  <p>Here is the front end of my page component:</p>
  <pre><code>@if (breadcrumbs != null)
      {
          &lt;Breadcrumbs Items=&quot;breadcrumbs&quot;&gt;&lt;/Breadcrumbs&gt;
      }
  
  &lt;BrowseByBusiness Alias=&quot;@Alias&quot;&gt;&lt;/BrowseByBusiness&gt;
  </code></pre>
  <p>I set up my breadcrumbs like so (the Alias on the API call is a route parameter):</p>
  <pre><code>protected async override Task OnInitializedAsync()
          {
              categoryDto = await _publicClient.Client.GetFromJsonAsync&lt;CategoryDto&gt;($&quot;api/Categories/GetCategoryByAlias/{Alias}&quot;);
  
              breadcrumbs = new List&lt;BreadcrumbItem&gt;
              {
                  new BreadcrumbItem(&quot;Browse By Category&quot;, &quot;/browse-by-category&quot;),
                  new BreadcrumbItem(categoryDto.Name, $&quot;/browse-by-category/{categoryDto.Alias}&quot;),
              };
  
              if (categoryDto.ParentCategory.Name != null)
              {
                  breadcrumbs.Insert(1, new BreadcrumbItem(categoryDto.ParentCategory.Name, $&quot;/browse-by-category/{categoryDto.ParentCategory.Alias}&quot;));
              }
          }
  </code></pre>
  <p>My BrowseByBusiness component:</p>
  <pre><code>@foreach (var businessDto in businessesDto)
              {
                  &lt;Animate Animation=&quot;Animations.Fade&quot; Easing=&quot;Easings.Ease&quot; DurationMilliseconds=&quot;2000&quot;&gt;
                      &lt;BusinessCard businessDto=&quot;businessDto&quot;&gt;&lt;/BusinessCard&gt;
                  &lt;/Animate&gt;
              }
  
  @code {
  
  [Inject] IBusinessHttpRepository _businessRepo { get; set; }
  
  public MetaData metaData = new MetaData();
  IEnumerable&lt;BusinessDto&gt; businessesDto;
  
  protected async override Task OnInitializedAsync()
          {
              await GetBusinesses();
          }
  
  private async Task GetBusinesses()
          {
              var pagingResponse = await _businessRepo.GetBusinessesByCategory(Alias, businessParameters);
              businessesDto = pagingResponse.Items;
              metaData = pagingResponse.MetaData;
          }
  }
  </code></pre>
  <p>My Breadcrumbs component:</p>
  <pre><code>&lt;div class=&quot;flex-row border-bottom pb-2&quot;&gt;
      @foreach (var item in Items)
      {
          if (item.Equals(Last))
          {
              &lt;span class=&quot;me-1&quot;&gt;@item.Name&lt;/span&gt;
          }
          else
          {
              &lt;a class=&quot;me-1&quot; href=&quot;@item.Url&quot;&gt;@item.Name &lt;/a&gt;
  
              &lt;span class=&quot;me-1&quot;&gt;/&lt;/span&gt;
          }
      }
  &lt;/div&gt;
  
  @code {
      [Parameter] public List&lt;BreadcrumbItem&gt; Items { get; set; }
  
      private BreadcrumbItem Last;
  
      protected async override Task OnInitializedAsync()
      {
          Last = Items.Last();
      }
  }
  </code></pre>
  <p>I'm using Blazor WASM and .net 6.</p>