import { useEffect, useRef, useState } from 'react'; import styles from '@system/TextArea.module.scss'; function TextArea(props) { const textAreaRef = useRef(null); const resizeTextArea = () => { if (!textAreaRef.current) { return; } textAreaRef.current.style.height = 'auto'; // will not work without this! textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`; }; useEffect(() => { resizeTextArea(); window.addEventListener('resize', resizeTextArea); return () => { window.removeEventListener('resize', resizeTextArea); }; }, []); return (