import * as React from 'react' ; import styles from './Input.module.scss' ; interface Props { placeholder ? : string ; value ? : string ; onChange ? : ( val : string ) => void ; } const TextInput = props => { const { placeholder } = props ; const [ value , updateValue ] = React . useState ( props . value ?? '' ) ; const handleOnChange = ( event ) => { updateValue ( event . target . value ) ; if ( props . onChange ) { props . onChange ( event . target . value ) ; } } ; return ( < input value = { value } placeholder = { placeholder } className = { styles . text } onChange = { handleOnChange } / > ) ; } ; export default TextInput ;