Skip to content

Commit 36efd76

Browse files
committed
adding text selection form
1 parent 03394d4 commit 36efd76

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/PhraseForm.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react'
2+
import {useRef} from 'react'
3+
4+
const PhraseForm = ({phrase, context, onSavePhrase}) => {
5+
const meaning = useRef()
6+
7+
const handleSubmit = (e) => {
8+
e.preventDefault()
9+
console.log(meaning.current.value);
10+
onSavePhrase(phrase, context, meaning.current.value)
11+
}
12+
return (
13+
<form onSubmit={handleSubmit}>
14+
<label>
15+
Phrase: {phrase}
16+
</label>
17+
<br/>
18+
<label>
19+
Context: {context}
20+
</label>
21+
<br/>
22+
<label>
23+
Meaning:
24+
<input type="textarea" name="meaning" ref={meaning}/>
25+
</label>
26+
<input type="submit" value="Submit" />
27+
</form>
28+
)
29+
}
30+
31+
export default PhraseForm

0 commit comments

Comments
 (0)