Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 2 years ago

React.js + TypeScript + Custom Hook + SCSS Newsletter Sign-up Form

accessibility, react, sass/scss, typescript, bem
Better5afe•850
@better5afe
A solution to the Newsletter sign-up form with success message challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Summary:

a) Upon submit, the form is checked by a custom hook which vefifies value provided in the input.

b) If an email is successfully submitted, it's saved within the Local Storage.

c) Users will receive an appropriate error message in the following scenarios:

  • The input is empty.
  • Provided value is not a valid email address.
  • The email has already been provided and it's present in the Local Storage.

d) The validity check is slighly delayed using a setTimeout() method which imitates sending a request to an external server and allows users to see a loading modal.

e) Loading modal is rendered in a separate div using React Portal.

f) Application state is managed by React Context.

g) Users can view the optimal layout for the interface depending on their device's screen size as well as see hover and focus states for all interactive elements on the page.

No questions from my side, however I will be grateful for any feedback.

Happy coding! 🎃

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Better5afe's solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License