Skip to content
Submitted over 2 years ago

Newsletter sign-up form with success message

react, react-router, typescript, vite
LVL 1
@Phoenix24-2
A solution to the Newsletter sign-up form with success message challenge

Solution retrospective


News-Letter using React

hey folks,

There a couple of things I can't quite work out myself.

1- Not sure how to pass user input email from SignUp Page to Success Page in a way that the email is not visible to everyone (which obvs is not a safe approach). I followed react router's new approach of passing formData to Route's action prop and I was able to catch it there, but idk how to pass it from there to another Route (in this case, SuccessPage.tsx) !!

Note: React Router's docs says it's recommended to use redirect method instead of useNavigate hook on action prop ... So, how to pass formData using redirect method while avoiding it to be visible in the URL ? (My guess is I should use loader prop on the other Route (SuccessPage) and useLoaderData method to get user input but this didnt quite work out because it return empty.)

2- Is there a better way of rendering different SVGs based on the device's veiwport width than the one I have used ? (meaning using window.innerwidth() approach ! )

Thanks in advance for any help.

Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Phoenix24-2’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