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 (
) } UsernameForm.propTypes = { onSet: PropTypes.func.isRequired, } export default UsernameForm