You need to sign in to do that
Don't have an account?
Kishore Vamsi 6
How to get first value in list of strings in LWC
I want to capture first values in list of string using js controller. my apex getListofString returning list strings.
nameList =[]; firstValue=''; getListofString().then(data => { this.nameList = data; this.firstValue=? })
Does using this.firstValue=data[0] work for your scenario?The below articles might help:
https://salesforce.stackexchange.com/questions/271003/accessing-single-element-of-list-from-apex-in-lwc
https://salesforce.stackexchange.com/questions/264631/lwc-how-to-handle-null-situation-before-the-data-is-loaded-from-controller?rq=1
Thanks