import React, { useState, useRef, useEffect } from 'react'; import styles from './app.less'; export default function App(props) { const area = useRef(); const [scrollHeight, setScrollHeight] = useState(0); const checkScrollbar = () => { setTimeout(() => { const el = area.current; if (!el || !el.clientHeight || !el.scrollHeight) return; return setScrollHeight(el.clientHeight < el.scrollHeight ? 4 : 0); }, 1); useEffect(() => { checkScrollbar(); }, []) return (