Interactive Feedback Form Component

Solution retrospective
I find it most challenging to find ways to persist state when routing to a new page. For the purpose of this project, I have chosen to store the "rating" state in URL and call useParam to retrieve the state on a new page. Would like to find out if there are other ways to do this.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @fazzaamiarso
Hello Francis!
You can persist your state in local storage. https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
// to set data in local storage localStorage.setItem('ratings', your rating value) // to retrieve data localStorage.getItem('ratings')
I have a suggestion. Could you just pass the
rating
state toThankyou
component and read it through props? I guess theforceRefresh
set to true cause your state to be resetted every page refresh.I hope it's helpful! Cheers😃
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