Introduction
cbwire is a ColdBox module that makes building reactive, modern apps easy without leaving the comfort of CFML.
Last updated
Was this helpful?
Was this helpful?
mkdir cbwire-demo
cd cbwire-demo
box coldbox create app .
box install cbwire@be
box server start<!--- ./layouts/Main.cfm --->
<cfoutput>
<!doctype html>
<html lang="en">
<head>
#wireStyles()#
</head>
<body>
#wire( "Counter" )#
#wireScripts()#
</body>
</html>
</cfoutput>// File: ./wires/Counter.cfc
component extends="cbwire.models.Component" {
// Reactive Data Properties
variables.data = {
"counter": "0"
};
// Action to increment counter
function increment(){
variables.data.counter += 1;
}
}<!--- ./views/wires/counter.cfm --->
<cfoutput>
<div>
<div>Count: #args.counter#</div>
<button wire:click="increment">
+
</button>
</div>
</cfoutput>