Mentally, everyone is different and you have to find what works for you. That's one reason playing lots of matches is important.
You need to be able to dispassionately analyze what is going well or going badly. This is usually difficult for emotional high-schoolers (it was for me). What worked for me is that even if I get angry about missing a shot or something bad happening, I learned to forget it and start thinking only about the current situation in the match before the next point. In that moment of calm, you can analyze what is working, what is not, and what you would like to do on the next point.