UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

15 lines (14 loc) 349 B
import { useEffect, useRef } from 'react'; export const useTextareaRef = (props) => { const { focus } = props; const textareaRef = useRef(undefined); // Focus useEffect(() => { if (focus && textareaRef.current) { textareaRef.current.focus(); } }, [focus]); return { textareaRef, }; };