forked from notnull/chatz
don't send empty messages
This commit is contained in:
parent
61580b76e6
commit
e2d1677a2e
@ -52,6 +52,9 @@ class Chat extends React.Component {
|
||||
|
||||
handleSubmit(e) {
|
||||
e.preventDefault()
|
||||
if (this.state.text === '') {
|
||||
return
|
||||
}
|
||||
const message = { socketId: socket.id, id: uuid(), text: this.state.text }
|
||||
const messages = this.state.messages.concat(message)
|
||||
this.setState({ messages, text: '' })
|
||||
|
Loading…
Reference in New Issue
Block a user