When we get a sharable link for an answer here, It gives the link with a hash parameter and when the link is loaded, it scrolls down and highlights the particular answer with a color. It works even if there are a lot of answers with pagination enabled. It automatically goes to the page and highlights the answer. How does that work?
I am working on a project where the situation is kind of the same as this and I have managed to achieve this without pagination. I have used React JS
(along with react-router-dom
for routes) for the front end and Django Rest Framework
for the backend.
I have a server-side pagination enabled list of answers and I can travel through pages in the front-end as well. But like earlier it does not highlight a particular answer with the hash parameter in the url if that answer is not on the front page. I have to manually give the page number where the answer exists and that is the only way it works for now.
Is there any way to travel though pages and find the answer automatically and highlight it?
Can I do the same thing as it does here in Stackoverflow with these frameworks and if yes, how?
Any answer would be great! Thank you!