-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateArea.jsx
34 lines (29 loc) · 1.07 KB
/
CreateArea.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import React from "react";
import { isPropertySignature } from "typescript";
function CreateArea(props) {
// const [titleInput, setTitleInput] = React.useState("");
// const [contentInput, setContentInput] = React.useState("");
// // const {titleAndContent, setTitleAndContent} = React.useState({
// // title : "",
// // content: ""
// // })
// function handleChange(event){
// if (event.target.name === "title"){
// const newTitle = event.target.value ;
// return setTitleInput(newTitle);
// } else if (event.target.name === "content"){
// const newContent = event.target.value ;
// return setContentInput(newContent) ;
// }
// }
return (
<div>
<form onSubmit = {props.onAddition}>
<input onChange={props.handleChange} name="title" placeholder="Title" value = {props.titleInput} />
<textarea onChange={props.handleChange} name="content" placeholder="Take a note..." rows="3" value = {props.contentInput} />
<button type="submit" >Add</button>
</form>
</div>
);
}
export default CreateArea;