I can't find the link now. The last time I looked electrolytes were recommended to correct electrolyte imbalance that can be caused by dehydration, medicines such as statins, others. Leg cramps have similar causes apparently. As I recall now I was having a bout of diarrhea and leg cramps and electrolytes were recommended for fluid replacement to help both. I got a bottle Pedialyte, Wally brand, and drank it. Both have been relieved. BTW the electrolyte solution tasted better at room temp.
I discovered some of my meds could be contributing to the cramps and dehydration. Also that one of the BP meds might help the cramps. That one I often forget in the evening, being more careful about that now.