This sort of relates to this question, Why does Luke’s saber call to Rey?, but it does not answer why Rey gets a flashback when she instantly touches the Lightsaber? Does the the Light-saber have something like a memory from who has used it? Or is it just touching a LightSaber brings back memories like any ordinary person does with something like smell and an old song they listened too when they were young?
EDIT: I would like this reopened and have a chance to respond by answering this question, as I think I have a I have an a canonical answer which is not based on opinion.
In Wookieepedia it states that Psychometry is the force behind what Rey experienced,
Psychometry was the Force ability of deducing information about people or events associated with an object solely by touching it. Whoever used that ability received input from sight, sound, and emotions. At the time of the Clone Wars, the Jedi Master Quinlan Vos was known for being proficient in psychometry, which made him an expert tracker. However, the Jedi Order did not approve of their members using psychometry to handle weapons of violence. The Order feared that, as the wielder's emotions could be sensed, the Jedi using his psychometric skill could be exposed to the dark side of the Force.