I would like the defaultValue of a TextField to show "Username" upon page render. onFocus, I would like "Username" to disappear so that the user may comfortably type. I tried the following:
function Login() {
const [usernameDefaultValue, setUsernameDefaultValue] = useState("Username");
return ( <div>
<TextField
required
id="standard-required"
label="Required"
defaultValue={usernameDefaultValue}
onFocus={() => setUsernameDefaultValue('')}
variant="standard"
/>
)}
but as it is currently the user must double-click the defaultValue ("Username") in order to clear the field for their actual username.