mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
fix(examples/todo): don't submit empty values (#10979)
This commit is contained in:
committed by
Brian Vaughn
parent
f2568605a7
commit
2e2dc6708f
@@ -26,6 +26,9 @@ class TodoApp extends React.Component {
|
||||
|
||||
handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
if (!this.state.text.length) {
|
||||
return;
|
||||
}
|
||||
var newItem = {
|
||||
text: this.state.text,
|
||||
id: Date.now()
|
||||
|
||||
Reference in New Issue
Block a user