ts(2532)와 마찬가지로 null 일때 안에 scrollWidth라는 속성이 없기 때문에 null이 아닐 경우를 작성해줘야 한다.

에러

const { scrollWidth, clientWidth, scrollLeft } = scrollRef.current;

해결

if (scrollRef.current !== null) {
        const { scrollWidth, clientWidth, scrollLeft } = scrollRef.current;
}