How It Works
Last updated
Last updated
This diagram shows the Counter we created in the Introduction and how CBWIRE re-renders our template and updates the DOM.
The user requests a page from the server that includes our Counter component.
ColdBox receives the request.
CBWIRE parses our component and initially renders it with its default values.
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.
The user clicks the button.
CBWIRE uses Livewire.js to intercept the user's click on the client side and send an XHR request to the server.
CBWIRE runs the increment() method, updating the data properties.
CBWIRE re-renders the template.
CBWIRE returns the re-rendered template to the browser.
CBWIRE uses Livewire.js DOM diffing technology to update the component on the page.