import React from 'react'; import PropTypes from 'prop-types'; /*controlled component: input form value controlled by React*/ const FormValue = (props) => { /*destructuring*/ const { value, valueName, onChange, onSubmit } = props; return ( /*one onChange handler for each value*/ /*input names should match state names*/ <>
); }; export default FormValue; FormValue.propTypes = { value: PropTypes.string, valueName: PropTypes.string, onChange: PropTypes.func, onSubmit: PropTypes.func };