chingu-voyages / v43-tier1-team-09

Mad Libs Number 9 | Voyage-43 | https://chingu.io/ | Twitter: https://twitter.com/ChinguCollabs
https://v43-tier1-team-09.netlify.app/
GNU General Public License v3.0
9 stars 3 forks source link

[FEATURE] Implement a history state to push browser location changes #182

Closed mnichols08 closed 1 year ago

mnichols08 commented 1 year ago

Is your feature request related to a problem? Please describe. I am always seeing users trying to press the back button.

Describe the solution you'd like Utilize the history API to create a browser history state allowing users to navigate using traditional browser controls

Describe alternatives you've considered The alternative is to look for another alternative lol

Additional context If we cannot get to this before the end of the voyage that is OK. If you want a challenge though this is a good one.

PaulaR-05 commented 1 year ago

ChallengeAcceptedLutherHargreevesGIF (2)

mnichols08 commented 1 year ago

I have been doing some research on this and I don't see us making this happen smoothly without leveraging a backend as well.

We could make the routes work where users could navigate back and forth throughout the page -but upon return if they come back to a page like /team or /story or whatever we might define as a route, without a backend in place to handle these, we would end up having users see an error 404.

This is the drawback to writing an app with vanilla JS. If we were writing this with react, we could just leverage react-router-dom which would essentially create a backend for us to handle routes and take users there accordingly all with a few lines of written code. But since we aren't leveraging a framework, we have to write a lot more logic. It is possible, but simply implementing routes in our SPA would only create another issue where users wouldn't be able to come back to previously stored pages in their brower history and I think that would actually be even worse.