I would agree with Stumpyfsr that is more about technique – choosing the right lines, using your legs to absorb the bumps, don’t sit on the seat so much, rather put your weight into your pedals so you feel part of the bike and not on top of the bike, and don’t tighten up when going over bumps, try to stay relaxed.
There are some equipment changes you can try – get some good flat pedals with pins and a good pair of MTB shoes like 5/10’s that will stick to those pedals. Better to learn how to ride with flats before switching to clipless, I’m still trying to unlearn bad habits I picked up because I started out with clipless pedals on my mountain bike. A dropper post may help you get over difficult terrain by getting your seat out of the way. While many XC purists will scoff at the weight penalty, I have one on my XC hardtail and it has made a world of difference in my riding capabilities.