How to fetch Inputs in Lightning Web Components

Updated: Feb 16

Lightning web components and Aura Components are like chalk and cheese, almost everything is different in LWC. To get started in LWC, reading input fields are really important. This article is going to explain all the ways user inputs can be read.


1. Using property -


We have bind a property "name" to lightning-input tag, and if any change happen in this field, it will call "nameChange" handler.










<!-- lwcinputs.html -->

<template>

<p>Hello, {name}!</p>

<lightning-input label="Name" value={name} onchange={nameChange}></lightning-input>