> For the complete documentation index, see [llms.txt](https://cbwire.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cbwire.ortusbooks.com/3.x/how-it-works.md).

# How It Works

HTML-over-the-wire explained.

This diagram references the Counter we created in the [Introduction](https://cbwire.ortusbooks.com/3.x/master.md) and shows how CBWIRE achieves reactive UI components with zero page refreshing.

<figure><img src="https://1609386017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEWvXvmxEDxwnAJzKYkxz%2Fuploads%2FDAeDliZCaNuWea21d52O%2FCleanShot%202023-05-22%20at%2006.51.41.png?alt=media&amp;token=6faab4ec-9f5e-4b70-a725-e9c4b9b141ef" alt=""><figcaption></figcaption></figure>

1. The user requests a page from the server that includes our Counter component.
2. ColdBox receives the request.
3. CBWIRE parses our component and initially renders it with its default values.&#x20;
4. The rendered component is sent to the browser.\
   ***It's important to understand that nothing extraordinary has happened at this point. We've returned HTML to the browser from an incoming request. Next is when things get interesting.***
5. The user clicks the button.
6. CBWIRE intercepts the user's click client-side and sends an XHR request to the server.
7. CBWIRE runs the increment() method, updating the data properties.
8. CBWIRE re-renders the template.
9. CBWIRE returns the re-rendered template to the browser.
10. CBWIRE uses Livewire's DOM diffing technology to update the component on the page.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cbwire.ortusbooks.com/3.x/how-it-works.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
