Walk through the standard Blazor component lifecycle, explaining the order of SetParametersAsync, OnInitialized, OnParametersSet, and OnAfterRender.

Last updated 5 July 2026

  • Order: SetParametersAsync (assigns [Parameter] values) → OnInitialized (once per lifetime) → OnParametersSet (first time and on every new parameter) → render → OnAfterRender.

  • OnAfterRender runs after the DOM updates with firstRender true on the first pass, making it the safe spot for JS interop. ShouldRender can suppress re-renders.

  • An await in the async hooks lets Blazor render an intermediate state, such as a loading indicator, before the task finishes.

  • https://learn.microsoft.com/en-us/aspnet/core/blazor/components/lifecycle?view=aspnetcore-10.0
  • https://www.coder000.com/post/blazor-component-lifecycle-and-state
  • https://www.telerik.com/blogs/blazor-basics-blazor-component-re-rendering
  • https://alexb72.medium.com/blazor-lifecycle-methods-oninitialized-onparametersset-and-onafterrender-36081a225d68
  • https://blazor-university.com/components/component-lifecycles/
  • https://medium.com/@shreyans_padmani/understanding-blazor-compontent-lifecycle-methods-in-c-69a9f9371c15
  • https://www.thinktecture.com/en/blazor/blazor-components-lifecycle-is-not-always-straightforward/
  • https://chrissainty.com/blazor-bites-component-lifecycle-methods/
All Blazor interview questions