Код: Выделить всё
const handleFormSubmit = async (e) => {
e.preventDefault();
const formData = new FormData(formRef.current);
const data = Object.fromEntries(formData.entries());
const result = await handleSubmit(data);
setTimeout(() => {
if (skeletonRef.current) {
skeletonRef.current.scrollIntoView({ behavior: 'smooth' });
}
}, 100); // here im delaying to ensure that the skeleton is rendered
};
Я также попытался обернуть кнопку отправки в
Generate
< /code>
с целевым элементом как: < /p>
{loading && (
{/* Skeleton content */}
)}
[/code]
Подробнее здесь: https://stackoverflow.com/questions/784 ... anchor-tag
Мобильная версия