According to medical school researchers cited by the National Institutes of Health, all solid foods replace electrolytes lost through sweat. Water is sufficient for rehydration when accompanied by solid food to replace lost electrolytes.
Problems with low electrolytes in otherwise healthy people come largely from drinking excessive amounts of fresh water without additional food. Fresh water contains very low concentrations of electrolytes, and it can dangerously dilute electrolytes in blood when consumed in large quantities, especially during exercise when electrolytes are rapidly lost through sweating. The greatest danger comes specifically from hyponatremia, or too little sodium in the bloodstream, which is a potentially life-threatening condition that has killed several athletes. Eating some solid food alleviates this risk, as can simply not drinking too much water.
Sodium is not the only physiologically important electrolyte, though. Others include potassium, calcium, magnesium, chloride, phosphate and carbonate. These are important to all known higher life forms, including all those that people consume as food. Certain foods contain more of some relatively scarce electrolytes, such as potassium and calcium, but electrolytes are found in significant concentration in all fruits, vegetables, meat, dairy products and eggs — effectively in everything except fresh water and excessively dilute sports drinks.