Here is an interesting article, written by pro cyclist Michael Barry, about racing in the Pyrenees and the need to take in calories to avoid "bonking" on a strenuous ride.
Also, broadcast during the Tour de France is the importance of hydration, "By the time you feel thirsty, you are already down 2% of body water and that translates to about an 11% drop in Max Power."
So, if you want to ride your best, the old adage applies "Eat before you are hungry and drink before you are thirsty."