Animate the height of an element when it opens and closes.
This is custom React hooks, you need to follow the Basic Rules when you use it.
Spread the style and onTransitionEnd on the element that grows and shrinks.
const useCollapse = <T extends HTMLElement = HTMLElement>(options: {
opened: boolean
duration?: number
}) => {
ref: RefObject<T | null>
style: CSSProperties
onTransitionEnd: () => void
}