Last active
July 16, 2016 20:33
-
-
Save jacobp100/d19c789450b3a4bf3651bb3681c9dd21 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const Cat = ({ cat, handleCatUpdateDelete }) => ( | |
<div> | |
<h1>{cat.name}</h1> | |
<form method="POST"> | |
<input type="hidden" name="action-creator" value="update-remove-cat" /> | |
<input type="hidden" name="id" value={cat.id} /> | |
<input name="name" defaultValue={cat.name} /> | |
<inputtype="number" name="age" defaultValue={cat.age} /> | |
<select name="gender" defaultValue={cat.gender}> | |
<option value="male">Male</option> | |
<option value="female">Female</option> | |
</select> | |
<button name="action" value="update" onClick={handleCatUpdateDelete}> | |
Update | |
</button> | |
<button name="action" value="remove" onClick={handleCatUpdateDelete}> | |
Delete | |
</button> | |
</form> | |
<Link to="/">Back</Link> | |
</div> | |
); | |
export default connect( | |
(state, { params }) => ({ | |
cat: state.cats.cats[params.id], | |
}), | |
dispatch => ({ | |
handleCatUpdateDelete: formDispatcher(dispatch), | |
}) | |
)(Cat); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment