import Typography from '@material-ui/core/Typography'; import TextField, {TextFieldProps} from '@material-ui/core/TextField'; type Props = TextFieldProps & { isEditing: boolean; }; const ProfileField = (props: Props) => { const {onChange, isEditing, ...inputProps} = props; const {name, label, value, defaultValue = ''} = inputProps; if (isEditing) { return ( onChange(e.target.value)} id={`Profile${name}`} {...inputProps} /> ); } return ( <> {label} {value || defaultValue} ); }; export default ProfileField;