He could react with confusion. For instance, if he overhears them having a very cryptic conversation that he can't fully understand. He might spend a long time trying to figure out what they really meant, and might even start to question his own understanding of their relationship.
Harry might react with shock. If he overhears something unexpected like Ron and Hermione confessing their love for each other, it would be a big surprise. He might stand there frozen for a moment, not knowing how to process it.
Harry may react with concern. If he overhears them talking about a dangerous plan or a problem they are facing but not sharing with him, he would be worried. He might immediately confront them to find out what's going on and offer his help, because he cares about them and doesn't want them to face difficulties alone.
Harry's reaction would depend on the nature of the fanfiction. If it's a cute, romantic fanfiction about Ron and Hermione, he might smile to himself and think it's kind of sweet. However, if it's something that distorts their characters or has a negative slant, he could get defensive. He might even try to find out who wrote it and why they would write such a thing about his friends.
At first, Harry could be heartbroken. He would wonder what he did wrong to make them leave. He might try to find them and reason with them. However, if he can't reach them, he would likely turn that pain into a driving force. He would focus on his goals, like fighting against Voldemort or protecting the wizarding world, even more fiercely, because he now has to prove himself not only to the world but also to his former friends.
Perhaps Harry overhears a very private and heartfelt conversation between Ron and Hermione. He might realize that their relationship has deepened in a way he hadn't noticed before. This could make Harry feel a bit left out at first, but then he would probably be happy for them. He could also use this new knowledge to be more understanding of their actions and decisions in the future.
Well, it could be really awkward for him. He might feel a bit strange knowing that people are writing fictional stories about his two best friends. He could also be a bit protective and might not like the way some fanfictions portray Ron and Hermione. Maybe he'll be amused too, depending on the content of the fanfiction.
Perhaps she tries to find them right away. Using her intelligence and resourcefulness, she starts to search for any clues as to where they might have gone. She could ask other friends, like Neville or Luna, if they have seen Harry and Ron. And she might be determined to bring them back, not willing to give up on their friendship easily.
Another way she could react is by distancing herself completely. She would stop trying to be part of their group and start creating her own identity at Hogwarts. She might explore parts of the castle she's never been to before, find new study nooks, and interact with students she's never really talked to, all while trying to forget about Ron and Harry's cold treatment.
At first, Harry might be confused. He would try to figure out what went wrong. He might search his memory for any signs that could have led to this betrayal. Then, he would likely experience a range of emotions from sadness to rage. Depending on the nature of the betrayal, he could either try to win them back by showing them the truth or decide that they are no longer worthy of his friendship and focus on his own path, maybe even leaving the wizarding world for a while to clear his head.
Ron could also be really happy for them. In certain fanfic scenarios, he might have noticed the chemistry between Hermione and Harry all along. So when Hermione asks Harry out, he's like the biggest cheerleader. He might offer to cover for them when they go on dates or give Harry advice on how to make Hermione happy. He would see it as a natural progression of their friendship and be glad that they are exploring a romantic relationship.
At first, Harry would probably be in shock. He has always considered Hermione one of his closest friends, so her betrayal would be a huge blow. He might not believe it at first and try to reason with her.
Hermione would probably be deeply hurt at first. She trusts Harry and Ron so much, and being abandoned by them would be a huge blow. But she's also very determined. So, she might throw herself into her studies even more, using her knowledge as a way to cope and also to find a solution to the situation.