I wanted to change this code which is using get method from lodash library to optional chaining method.Can someone help me to convert this
return get(
this.UIObj,
'excelList',
[]
);
Optional return the excelList
property of this.UIObj
, and if it's undefined
(or null
) return an empty array using the Nullish coalescing operator (??):
return this.UIObj?.excelList ?? []