Notes
The lightning-input field uses the onchange attribute to listen for a change to its value. When the value changes, the handleChange function in the JavaScript file executes.
Notice that to bind the handleChange function to the template, we use the same syntax, {handleChange}.
myName.html
<template>
<p>My name is: {name}!</p>
<lightning-input label="name" value={name} onchange={nameHandler}></lightning-input>
</template>
myName.js
import { LightningElement } from 'lwc';
export default class MyName extends LightningElement {
name = 'John Carter';
nameHandler(event) {
this.name= event.target.value;
}
}