There are many salts the body needs besides potassium, such as chloride, magnesium, sodium, etc...while potassium is most associated with muscle cramping, it is not always the cure.
Proper nutrition is key, along with being in good shape for hiking, not just good physical conditioning.