forked from Ada-C15/front-end-inspiration-board
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from melissa-nguyen/Melissa-1
added state, title event handler and owner event handler to NewBoardF…
- Loading branch information
Showing
1 changed file
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,37 @@ | ||
import './NewBoardForm.css'; | ||
import PropTypes from 'prop-types'; | ||
import { useState } from 'react'; | ||
|
||
const NewBoardForm = (props) => { | ||
|
||
// create state to handle 'title' and 'owner name' changes | ||
const [title, setTitle] = useState(''); | ||
const [owner, setOwner] = useState(''); | ||
|
||
// function to handle new title input | ||
const onTitleChange = (event) => { | ||
setTitle(event.target.value) | ||
}; | ||
|
||
// function to handle new owner input | ||
const onOwnerChange = (event) => { | ||
setOwner(event.target.value) | ||
}; | ||
|
||
// return jsx w/ label & input | ||
|
||
const NewBoardForm = () => { | ||
return ( | ||
<section> | ||
</section> | ||
<form> | ||
<div> | ||
<label>Title</label> | ||
<input type="text" value={title} onChange={onTitleChange} /> | ||
</div> | ||
<div> | ||
<label>Owner's Name</label> | ||
<input type="text" value={owner} onChange={onOwnerChange} /> | ||
</div> | ||
</form> | ||
); | ||
} | ||
}; | ||
|
||
export default NewBoardForm; |