This is a solution to the Conference ticket generator challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- Complete the form with their details
- Receive form validation messages if:
- Any field is missed
- The email address is not formatted correctly
- The avatar upload is too big or the wrong image format
- Complete the form only using their keyboard
- Have inputs, form field hints, and error messages announced on their screen reader
- See the generated conference ticket when they successfully submit the form
- View the optimal layout for the interface depending on their device's screen size
- See hover and focus states for all interactive elements on the page
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Mobile-first workflow
- React - JS library
- Express
- Vite SSR
I learned new react 19 hook useActionState. This hook reduces use of useState hook. Also no need to use third party form libraries for forms. This form is designed like react-hook-forms.
Following design specifications are achieved,
-
50% less re-rendring of the forms
form render react-hoot-forms 4 times on submit useActionState form 2 times on submit Form fields render react-hook-form rerender with parent form useActionState form rerender on prop change(memoised) -
8% Less bundle size
-
Mounting Phase:
-
UseActionStateForm:
- Actual Duration: 7.3 ms
- Base Duration: 4.3 ms
- Start Time: 1170.2 ms
-
react hook Form:
- Actual Duration: 4.9 ms
- Base Duration: 3 ms
- Start Time: 1135.7 ms
react hook Form mounts faster than UseActionStateForm with a lower actual and base duration.
- Update Phase:
-
UseActionStateForm:
- Actual Duration: 0.6 ms
- Base Duration: 4.5 ms
- Start Time: 124883.5 ms
-
react hook Form:
- Actual Duration: 2.3 ms
- Base Duration: 2.3 ms
- Start Time: 207708.4 ms
UseActionStateForm updates faster than react hook Form with a significantly lower actual duration.
-
Also I learned about clamp() function is ccs. This function reduces use of media query. Responsive pages are easy to design with clamp() especially font-size and widths.
-
Built SSR form using express and vite ssr bundler. SSR forms reduces initial page rendering for client. This improves user experience. SSR live demo Note :- page might be slow because response is delayed by 50 secound by render.com. The puprpose on this SSR rendering to test/learn reacts api renderToPipeableStream on express app.
Form page | Ticket Page |
---|---|
![]() |
![]() |
Form page errors | Form page field |
---|---|
![]() |
![]() |
Change and remove btn | web vitals results |
---|---|
![]() |
![]() |