How do I push data and update the UI from the server to the browser in Blazor?

By calling the StateHasChanged() method in Blazor, you can receive notifications about state changes and trigger component re-rendering to push the changes to the browser using SignalR. An example that illustrates this functionality is the Counter component. In this example, the component automatically pushes incremented count data using the Timer function and updates the UI in the browser by invoking the StateHasChanged() method within the InvokeAsync action.  [Counter.razor] Refer to this link for more details.

Why are Blazor lifecycle methods getting executed twice?

In a Blazor Server app, the default RenderMode is Server Prerendered. When the component is rendering with the ServerPrerendered render mode, the component is initially rendering statically as part of the page.  On executing the first time, it is rendered as an MVC component directly when the page is requested and handled by “_Host” which is specified in “_Host.cshtml”.  Then the resources are loaded with the blazor.server.js script and start rendering a second time. Then the Razor pages are loaded as a Blazor component. Note: If you are changing the RenderMode to Server, the lifecycle method executes only once. [Pages/_Host.cshtml]  Refer to this link for details. 

How do I add a delay to an event (OnInput) in Blazor?

Use the System.Timers.Timer class to wait until the user has finished typing in the text field. The onkeyup event triggers for each key press and resets the timer until the last timer raises the OnUserFinish event. [Index.razor] View Sample in GitHub

How do I animate state transitions in Blazor?

In the following example, we’ve animated state transitions using CSS in a Blazor app. When the state is changed, adding and removing the property values for every state transition is animated. Create a separate reusable component (.razor) in the Pages folder and add the animation. [Pages/AnimeState.razor] Add the AnimeState.razor component and define the property value to be animated when the state has been changed. [Index.razor] View Sample in GitHub