# How does Blazor Work?

Blazor is particularly well-suited for the MVVM (Model-View-ViewModel) pattern, which helps organize the migrated code.

<figure><img src="/files/PTGrafaD2fM9hCzUfUXY" alt="" width="375"><figcaption><p>Blazor standard flow</p></figcaption></figure>

The interaction follows a precise 7-step cycle:

1. DOM Event: The user clicks a button or interacts with the browser.
2. Event Relay: The click is sent over a WebSocket connection to the server-side View Model.
3. State Change: The View Model runs the original business logic and updates the Model (data).
4. View Model Update: The View Model detects the data change and tells the HTML renderer to refresh.
5. HTML Rendering: The renderer calculates the difference (delta) between the old view and the new one.
6. Visual Delta Transport: Only that tiny change is streamed back to the browser asynchronously.
7. DOM Update: The browser's "Client Proxy" updates the specific part of the screen the user is looking at.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/blazor-ai-migrator/blazor-ai-migrator/modernization/how-does-blazor-work.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
