First, supplement calcium properly, don't be picky about food, and pay attention to the comprehensive nutrition.
Second, before going to bed at night, it is best to soak your feet with hot water, which is not only conducive to eliminating fatigue, improving sleep quality, but also preventing leg cramps.
Third, keep your legs warm when you sleep. Many people know to keep warm when sleeping in winter, but they often ignore the leg warmth in summer and autumn. Turn on the air conditioner in summer, and the temperature is low in autumn. If the legs and feet are exposed, it is easy to cramp.
Fourth, when cramping, pull your feet (or toes) by hand and pull hard in the opposite direction of cramping, which will be relieved in a few minutes.