So my plan was when in the Edit poll page, you have the option to delete the poll.
The delete function works but then what?
How do I handle the fact that this poll no longer exists?
I was thinking redirect back to the home page or a message saying “Poll deleted” but both need to re-direct away from this poll.
Not sure what the problem is with redirecting?
Problem is I don’t know how to. And if I do, how do I send a message to the user? Pass a query string?
I have almost no experience with React, but I suppose you are using a router? Or is the server handling the routing?
I am using REACT router but as it is a Full stack app, Node does some routing too. I’m just not sure what to do so I was hoping others who have done it can point me to the best option.
If you are using the React router this might help:
Ok that gives me a few options but it doesn’t look like a 5 minute job and I am going out now so I will check it later.
Seems like I can just do:
location.replace('/'); after doing the delete API call.
More about the location object