import { useEffect, useRef, useState } from '@wordpress/element' import { __ } from '@wordpress/i18n' import { Icon } from '@wordpress/icons' import { send } from '@chat/svg' import classnames from 'classnames' export const Question = ({ setQuestion }) => { const queryInput = useRef(null) const [inputValue, setInputValue] = useState('') const submit = (e) => { e.preventDefault() if (!inputValue) { return } setQuestion(inputValue) } useEffect(() => { // Focus the input when the component mounts queryInput.current.focus() }, []) return (
) }