У меня следующее условие:
useEffect(() => {
const hasFalsyValue = (
dropdownValue === undefined
|| dropdownValue === null
);
if (hasFalsyValue && !onChangeText) {
return;
}
onChangeText(dropdownValue);
}, [
dropdownValue,
onChangeText,
inputProps,
]);
Если hasFalsyValue
истинно, то эффект сразу же вернется. Но TS кричит на меня, говоря, что dropdownValue
все еще может быть undefined
If I extract the conditions from the constant and put it inside the conditional parenthesis, it will work
введите описание изображения здесь