I can't change or type inside an input, I have the input inside a form and it's value set to user.email, when I try to change the text it won't type
const [email, setEmail] = useState("");
const handleSubmit = async (e) => {
e.preventDefault();
dispatch({type: "UPDATE_START"})
const updatedUser = {
userId: user._id,
username,
email,
};
try {
const res = await axios.put("/users/"+user._id, updatedUser);
setSuccess(true);
dispatch({ type: "UPDATE_SUCCESS", payload: res.data });
} catch (err) {
dispatch({type: "UPDATE_FAILURE"});
}
};
<form className="settingsForm" onSubmit={handleSubmit}>
<div class="relative w-full">
<div class="flex absolute
inset-y-0 left-0 items-center pl-3
pointer-events-none">
<EmailIcon class="w-5 h-5" />
</div>
<input type="text"
className="loginInput"
style={{ border: error ? '1px solid red' : '' }}
value={user.email}
onChange={(e) => setEmail(e.target.value)}/>
</div>
<button
className="loginButton"
type="submit"
disabled={isFetching}>
{isFetching ? (
<CircularProgress size={15}/>
) : (
<Typography
variant="subtitle2"
color="white">
Save Changes
</Typography>)}
</button>
</form>
I don't what I'm missing here, and I don't want the user.email to be placeholder, I want to treat as a value and be changeable.