UseContext

May 18, 2026 ยท View on GitHub

method
cref: M:Microsoft.UI.Reactor.Core.RenderContext.UseContext``1(Microsoft.UI.Reactor.Core.Context{``0})

Learn more: Hooks, Effects

Summary

Reads the nearest ancestor's provided value for the given context. Returns the context's DefaultValue if no provider exists in the ancestor chain. Follows hook rules โ€” must be called in the same order every render.