Trying to create a theme to access posts last clicked, Can someone tell me how can i access the state of the posts being clicked?

I am trying to read the repository of discourse in order to develop a plugin, I am failing to understand on how to access the or create a state or array which stores the id of last 3 clicked posts by user, so it can displayed as a list on the top of the forum.

Can someone guide me on which file will find the component being used to display the posts