1import React, { useState, useEffect, useRef } from 'react'
2
3export default () => {
4 const [height, setHeight] = useState(0)
5 const ref = useRef(null)
6
7 useEffect(() => {
8 setHeight(ref.current.clientHeight)
9 })
10
11 return (
12 <div ref={ref}>
13 {height}
14 </div>
15 )
16}
17