import { useState } from 'react' import PropTypes from 'prop-types' import '../styles/chat.css' function UsernameForm({ onSet }) { const [name, setName] = useState('') const handleSubmit = (e) => { e.preventDefault() const trimmed = name.trim() if (!trimmed) return onSet(trimmed) } return (
setName(e.target.value)} placeholder="Enter your name..." />
) } UsernameForm.propTypes = { onSet: PropTypes.func.isRequired, } export default UsernameForm