Hey, I have this code snippet below which includes a call to the isSomeFunction method that returns true or false. However, there are times when the argument can be undefined. I only want to execute this function if selectedItems is not undefined. How can I achieve this?
<Button
disabled={
(selectedItems !== undefined && isSomefunction(assetIds, selectedItems)) ||
isButtonDisabled
}/>
I'm getting an error saying "undefined is not assignable to type string." How do I check if selectedItems is not undefined before calling the isSomeFunction in this case to avoid the error?
If anyone could assist me with this, I would greatly appreciate it. Thank you!