Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Store a signup email as a plain string in React state, pass it to the input’s value, and synchronously update that same state in onChange. In TypeScript, an extracted handler can use React.ChangeEvent<HTMLInputElement>. The string represents what the user is editing—not an address that has been validated or verified.

Keep the email value as a string

A user may leave the field empty, type a partial address, or enter text that is not a valid email format. The input’s state should accommodate all of those editing steps. Use a string rather than a type that implies the address has already been checked or belongs to the user.

React’s controlled-input pattern uses a string state value as the input’s value, then updates that state from the user’s edits. See the React input reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Type and wire the change handler

A basic controlled field can look like this:

import { useState } from 'react';

export function SignupEmail() {
  const [email, setEmail] = useState('');

  function handleEmailChange(event: React.ChangeEvent<HTMLInputElement>) {
    setEmail(event.currentTarget.value);
  }

  return (
    <label>
      Email address
      <input
        type="email"
        name="email"
        autoComplete="email"
        value={email}
        onChange={handleEmailChange}
      />
    </label>
  );
}

For an extracted handler, React.ChangeEvent<HTMLInputElement> describes the change event for an input, and event.currentTarget.value supplies its current text. TypeScript can also infer the event type for an inline handler from the input’s onChange prop. React documents these patterns in its TypeScript guide.

Because the input is controlled, its value comes from email. Update that state directly in the change handler; otherwise React can restore the previously supplied value after a keystroke. The name attribute also provides the field’s key in submitted form data.

Why a controlled email field can revert while typing

If an input receives value={email}, React treats the state as the displayed value. When the user types, the handler must update email synchronously. If it does not, React will put the old state value back into the field. This is the common cause of a controlled input that appears to reject typing.

  • Confirm that the input has onChange wired to the handler.
  • Confirm that the handler calls the state setter with event.currentTarget.value.
  • Keep the value a string throughout editing; do not switch between an initial string and an undefined value.

For a large component tree where keystroke-driven renders cause performance problems, React suggests moving the input state into a smaller component or, when appropriate, using useDeferredValue. See the input reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose controlled state or read the value at submission

There is no universal winner. Use controlled state when the interface needs to respond to edits—for example, to update a hint or validation message while the user types. If the UI does not need the value on every edit, React also documents handling the form’s onSubmit event, preventing the browser’s default submission, and reading the submitted data then.

Choose based on what the form needs to do:

  • Per-edit behavior: Keep the field controlled when other UI needs the current value as the user types.
  • Submission behavior: A submit handler can read form data when the value is needed only at submission time.
  • Rendering scope: If controlled updates affect too much of a slow tree, isolate the field’s state in a smaller component or consider useDeferredValue.

React describes form submission handling in its form reference.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Separate format checks from signup status

<input type="email"> gives the browser an email-oriented control and basic format validation. It does not prove that the mailbox exists, that the user owns it, or that the address meets a service’s requirements. MDN explains these limits in its email input reference.

Client-side validation is not a substitute for server-side validation: users can change or bypass checks that run in the browser. If signup depends on proving account ownership, use a separate verification step, such as sending a confirmation message. A format check alone cannot establish ownership.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the email string separate from the signup lifecycle. The field can remain unchanged while the form moves from editing to submission and then to a server-reported error or success. Model those statuses separately so a valid-looking string is not mistaken for a completed signup. React’s state guide discusses responding to text edits, submission, and network success or failure.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.