Created
October 20, 2018 10:18
-
-
Save lomse/41723a1173bae08f88bd52cdd22f0863 to your computer and use it in GitHub Desktop.
TodoForm.jsx with events
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
import React from 'react' | |
import styled from 'styled-components' | |
import PropTypes from 'prop-types' | |
const FormInput = styled.input` | |
width: 235px; | |
outline: none; | |
font-size: 13px; | |
padding-top: 7px; | |
padding-bottom: 7px; | |
padding-left: 10px; | |
` | |
const TodoForm = props => { | |
const { handleSubmit, handleOnchangeInput } = props | |
return ( | |
<div> | |
<p>Enter your todo and hit the Enter key </p> | |
<form onSubmit={handleSubmit}> | |
<FormInput placeholder="Enter new todo" onChange={handleOnchangeInput} /> | |
</form> | |
</div> | |
) | |
} | |
TodoForm.defaultProps = { | |
handleSubmit: () => {}, | |
handleOnchangeInput: ()=>{} | |
} | |
TodoForm.propTypes = { | |
handleSubmit: PropTypes.func, | |
handleOnchangeInput: PropTypes.func | |
} | |
export default TodoForm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment