How can I determine which working React component was last seen in the viewport?

My aim is to be able to identify which video the user last viewed in the viewport. Up until the point when I converted the videos into useful React components, this was functioning but unable how can I find it or track it. I will be very thankful if someone helps me with this.