Leg/groin cramps

I’m almost 23 weeks and I have been having groin n leg cramps that are very very painful they only come at night and go away once I lay on my back for a few seconds. Anyone else dealing with this? Any ideas on how to help with them or avoid them all together?