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.
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.
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.
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.
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.
Hermione may also become more empathetic towards those who are considered outsiders, like Draco. Having been abandoned by her closest friends, she can understand what it's like to be alone. This could lead to her reaching out to Draco in a way she might not have before. She could see past his Slytherin exterior and try to understand his insecurities and motives, which in turn could change her own character as she becomes more open - minded.
It could be that Ron and Hermione abandon Harry due to a prophecy that they misinterpret. They believe that by being with Harry, they will bring doom to the wizarding world. So they go into hiding. Harry, on the other hand, is determined to change the course of the prophecy. He embarks on a journey to find the truth behind it, all while feeling the pain of his friends' desertion. He has to fight against dark forces that are taking advantage of the situation.
In such a fanfiction, it might be that Harry and Ron are influenced by a powerful dark spell. This spell makes them see Hermione as a threat, so they abandon her. Hermione then has to find a way to break the spell's influence on them while also dealing with the loneliness and danger she's now in. She could seek help from other Hogwarts students or even some friendly magical creatures.
Harry could initially be in shock. He's always counted on Hermione, so her abandonment would be a huge blow. He might feel a sense of betrayal and confusion.
In fanfiction, their friendship often develops through shared challenges. For example, when they face a new dark magic threat in the wizarding world, they rely on each other more. Harry's leadership, Ron's humor in tough situations, and Hermione's knowledge combine to make them closer. They also develop their friendship by having deep conversations about their fears and hopes for the future. Maybe Harry shares his concerns about being the Chosen One, and Ron and Hermione support him wholeheartedly.