Render State Provider

Cascades a RenderState value that tells descendant components whether the subtree is interactive yet. It renders no DOM element of its own.

Observe the Render State

The provider starts with IsInteractive = false and swaps in true after its first interactive render. OnAfterRender never runs during prerendering or static server rendering, so output produced there always reports false.

Consuming the Value

Declare a cascading parameter of type RenderState in any descendant. The parameter is null when the component is not inside a provider, which is why the checks below use == true and != true.

Gate a Control Until Interactive

The point of the flag: keep the essential content in the prerendered HTML, but avoid offering a control that cannot do anything yet. Do not rely on the flag alone to label a control — a disabled button still needs its text.