Muscle cramps during or after exercise are common and painful, yet the cause is still debated. The popular explanation of dehydration and salt loss is only part of the story at best.
Main ideas in the research:
A leading hypothesis is altered neuromuscular control due to fatigue, which fits why cramps often hit muscles working hard late in an event
Dehydration and electrolyte loss may contribute for some people, particularly salty sweaters in hot conditions, but the evidence is inconsistent
Gentle stretching of the cramping muscle usually relieves it
Pickle juice may shorten cramps quickly, possibly through a reflex from the mouth rather than by replacing salt
Prevention that fits the fatigue hypothesis: train specifically for the demands of the event, pace sensibly, and arrive well fuelled. Many cramp-prone athletes find that cramps arrive when they go out faster or longer than they have prepared for.
A sodium plan is still sensible in long, hot events, but it is unlikely to be the whole solution.