Skip to content

Commit 185ae69

Browse files
committed
onEnter
1 parent 0af3623 commit 185ae69

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Cards/AddCard.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ function AddCard({ onCreate, onDeleteAll }) {
4242
}
4343
}
4444

45+
function onEnter(e) {
46+
e.preventDefault()
47+
submitHandler()
48+
}
49+
4550
return (
4651
<div className="container">
4752
<div className="row my-2 text-center">
@@ -53,6 +58,7 @@ function AddCard({ onCreate, onDeleteAll }) {
5358
minRows={1}
5459
maxRows={3}
5560
maxLength="100"
61+
onKeyPress={e => e.key === 'Enter' && onEnter(e)}
5662
/>
5763
</div>
5864

0 commit comments

Comments
 (0)