Any solutions on how I can achieve similar results like this guy does with Javascript in React? Check link -> https://codepen.io/matheusls94/pen/WOdRPR
I have an inputfield/textfield(mui) which makes a post request to the server when a new user wants to register a new account/e-mail address. I want the user to avoid typing "@hotmail.com" which should be a fixed value that is uneditable/unremovable in the input field. Like in the codepen link above.
Dynamic value example -> Testemail, fixed value -> @hotmail.com
const [email, setEmail]=useState("");
async function Register(e){
let item = {email};
e.preventDefault();
setLoading(true);
let result = await fetch("https://localhost:44334/api/Register",{
method:"POST",
headers:{
"Accept": "text/plain",
"Content-Type": "application/json-patch+json",
},
body:JSON.stringify(item),
});
result = await result.json();
return (
<>
<Container className="mt-5">
<Row>
<Col lg={4} md={6} sm={12} className="text-center mt-5 p-3">
<img className="icon-img" src={loginIcon} alt="icon"/>
<Form onSubmit={Register}>
<Form.Group>
<Form.Label>E-Mail</Form.Label>
<input value={dynamicvalue+fixedvalue} type="text" required={true} onChange={(e) => setEmail(e.target.value)} fullWidth />
</Form.Group>
</>
)