➡️ Newsletter
Basic newsletter example.
➡️ Tech
- Vite, React, TS
- React Router
- Basic Input validation via Regex
➡️ Code
-
Input-Validation:
- Currently validation happens on button-click, which is everything but optimal. Further improvement in the next iteration. (![https://github.com/j-eick/FEM-newsletter/blob/main/src/components/input/Input.tsx][link])
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(); }