Prevention is easy and best as treatment can be difficult.
Our electrolyte concentration in the body is controlled by a variety of hormones; these are mostly found in the kidney and the adrenal glands. And these specialized kidney cells monitor the amount of sodium, potassium, and water in the bloodstream The main electrolytes exist in the form of calcium, chlorine, magnesium, phosphate, potassium, and sodium that can be obtained from fluids, supplements, and foods. Sodium, Potassium and Magnesium are vital, and combined with glucose and water is an essential supplement (drink) to any serious athlete who is pushing themselves to the point of exhaustion.
When exercising at extreme levels over time these electrolytes are lost in sweat and exhaled breathing. Sodium chloride is the primary electrolyte in sweat, with potassium, calcium, and magnesium present in smaller amounts. If not replaced an imbalance can cause muscle spasms, kidney failure and cardiac arrhythmias that can lead to coma and death.
Prevention is the answer. always replace loss water and electrolytes.