import TextField, { TextFieldProps } from '@mui/material/TextField' import { noop } from 'lodash/fp' import React, { FC } from 'react' /** * This is actually a hyper controlled text field */ const UncontrolledTextField: FC = ({ value = '', onChange: _onChange = noop, ...props }) => { const [localValue, setLocalValue] = React.useState(value) React.useEffect(() => { setLocalValue(value) }, [props.id]) const onChange: React.ChangeEventHandler = (e) => { const el = e.target as HTMLInputElement setLocalValue(el.value) _onChange(e) } return ( ) } export default UncontrolledTextField