Skip to content

Commit

Permalink
Merge pull request #2 from melissa-nguyen/Melissa-1
Browse files Browse the repository at this point in the history
added state, title event handler and owner event handler to NewBoardF…
  • Loading branch information
jittania authored Jun 29, 2021
2 parents 36b1d20 + d65c00d commit 198508f
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions src/components/NewBoardForm.js
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;

0 comments on commit 198508f

Please sign in to comment.