У меня есть следующий код - USEMEMO вычисляет, готов ли контейнер, но на самом деле, когда появляется контейнер, он возвращает false, есть ли способ сделать это? PrettyPrint-Override "> const containerReady = useMemo(() => {
const scrollHeight = messagesContainer.current?.scrollHeight;
const clientHeight = messagesContainer.current?.clientHeight;
if (!scrollHeight || !clientHeight) return false;
return true;
}, [
messagesContainer.current?.scrollHeight,
messagesContainer.current?.clientHeight,
]);
console.log("Container ready:", containerReady);
Подробнее здесь: https://stackoverflow.com/questions/793 ... ent-height