Data Properties
The state of the our components.
Components have state known as Data Properties.
Data Properties are defined by creating a data structure on your component and assigning each property a default value.
<!--- ./wires/SomeComponent.cfm --->
<cfscript>
data = {
"propertyName": "defaultValue"
};
</cfscript>Data Properties are visible to JavaScript. You SHOULD NOT store sensitive data in them.
Initial Values
Data properties should be assigned a default value, even if it's just an empty string.
Using Data Properties
You can access Data Properties from within your component Actions like so.
You can also reference Data Properties within your component template using #propertyName#.
Resetting Data Properties
You can reset properties back to their original value inside your Actions using reset().
You can reset individual or all Data Properties.
You also can reset all properties EXCEPT the properties you pass.
Data Binding
You can bind your data properties and HTML elements using wire:model.
There are also several modifiers you can add to control when and how requests are sent to your server.
Last updated