How the LWC HelloWorld Works

Lightning comes with a built-in robust style library. In the HTML (Template) file we use one of the built in styles (class="slds-m-around_medium" ) to give a default Lightning-style margin around most of the HTML content.

The heavy lifting of HelloWorld can be traced to the lighting-input field in the HTML file. The lighting-input field uses the onchange attribute to listen for a change to its value. When the value changes, the changeHandler() function in the JavaScript file executes.

To bind the changeHandler() function to the template, we use the same syntax with the curly braces: {changeHandler}.

Deploy HelloWorld to a Dev Org