Skip to content

j-eick/FEM-newsletter

Repository files navigation

➡️ Newsletter

Basic newsletter example.

➡️ Tech

  • Vite, React, TS
  • React Router
  • Basic Input validation via Regex

➡️ Code

  • Input-Validation:

    const checkInput = /^[a-zA-Z0-9.]{1,25}@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]{2,5}$/;
    
    if (checkInput.test(input)) {
      setIsEmailInvalid(false);
    } else {
      setIsEmailInvalid(true);
    }
    
    if (inputRef.current) {
      inputRef.current.focus();
    }