Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

SignUp page using React + typescript

@WolfMozart8

Desktop design screenshot for the Newsletter sign-up form with success message coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


This is my first time using both TypeScript and React, and it was fun, but very challenging. The page shouldn't be that difficult, but I still faced some difficulties. Aside from that, I would appreciate some feedback on my React and TypeScript skills. I know some of my code can be a bit chaotic, and the organization might not be optimal. I'm not sure if I used useContext correctly. So, any feedback is welcome. :)

Community feedback

@akpekig

Posted

Functionally, your solution is perfect!

In terms of code, I do think there's a bit of code smell as a result of not really using React or Typescript to their fullest potential. In src/components/SignUp/Info.tsx, three elements are repeated instead of interated using a map or loop function. In src/components/SignUp/Form.tsx, you allow the pages context to be potentially null instead of writing some try-catch or conditional to make sure it always exists. I understand this was likely done to get around Typescript errors, but Typescript errors aren't meant to be gotten around like some kind of bug; they're a tool to help you spot where such validation is necessary.

I think the best use of these frameworks appears in src/components/UI/Button.tsx. It's the perfect combination of typing props and componentisation.

Marked as helpful

1

Please log in to post a comment

Log in with GitHub
Discord logo

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