title: Blazor - Display wait or spinner on API call
body: <p>In my Blazor app I am making an API call to a back end server that could take some time. I need to display feedback to the user, a wait cursor or a &quot;spinner&quot; image. How is this done in Blazor?</p>
  <p>I have tried using CSS and turning the CSS on and off but the page is not refreshed until the call is completed.  Any suggestions would be greatly appreciated.</p>
  <pre><code>@functions {
      UserModel userModel = new UserModel();
      Response response = new Response();
      string errorCss = &quot;errorOff&quot;;
      string cursorCSS = &quot;cursorSpinOff&quot;;
  
      protected void Submit()
      {
          //Show Sending...
          cursorCSS = &quot;&quot;;
          this.StateHasChanged();
          response = Service.Post(userModel);
          if (response.Errors.Any())
          {
              errorCss = &quot;errorOn&quot;;
          }
          //turn sending off
          cursorCSS = &quot;cursorSpinOff&quot;;
          this.StateHasChanged();
      }
  }
  </code></pre>