У меня есть переменная состояния, подобная следующей
const Home = ({ t, i18n, history }) => {
const [otherStudiosAvailable, setOtherStudiosAvailable] = useState([]);
const studios = ["de", "fr", "pl", "en", "nl", "ru"];
const otherStudios = studios.filter(item => {
return item !== i18n.language;
});
useEffect(() => {
let others = [];
for (const studio of otherStudios) {
checkForAvailableAgent(
`sales_${studio}`,
"Linktostudio",
"serviceID"
)
.then(res => {
others[studio] = res;
setOtherStudiosAvailable(others);
})
.catch(error => {
console.log("an error happened.");
});
}
}, []);
}
{otherStudiosAvailable.indexOf(true) ? (
<Button
variant="success"
onClick={e => callBtnClick("flag")}
>
Other studios available
</Button>
) : ("")
}
Мне нужно иметь условную проверку в JSX на основе otherStudiosAvailable, если она имеет хотя бы одно истинное значение
, любая помощь будетбыть оцененным.