It depends on what is causing them. Low potassium, for example, if you have that, eating foods rich
in potassium, such as sweet potatoes, bananas, etc. would be good. If you have cramps because you are taking a statin drug for lowering your cholesterol, you might talk to your doctor about switching to a different medication that is less likely to give that as a side effect.