Blazor lacks native signal support, but you can implement a Signal<T> system similar to Angular's. The approach uses an ambient AsyncLocal context to track which signals are read during rendering, then notifies observers when values change. A custom Reactive component wraps render fragments, subscribes to signals accessed during render, and calls StateHasChanged() automatically when dependencies update. The implementation also supports Computed<T> values that lazily re-evaluate when upstream signals change, eliminating the need to manually call StateHasChanged() in timer callbacks or other non-event-driven update scenarios.

7m read timeFrom steven-giesel.com
Post cover image
Table of contents
SignalsSignal<T> in BlazorResources
1.5K Impressions