If you have eaten a good breakfast (or meal if you ride later) within a few hours of riding you should be good for an hour before you need calories. After that you need to start consuming some calories every 20-30 minutes.
I take along Clif Luna Moons on rides under 50 miles. On rides over 50 I also take along a single serve pack of pringles and a small bag of beef jerkey.
I also use a custom blended electrolyte drink from a company called Infinit Nutrition. You can find them online. But any electrolyte/energy drink of your choice will do.
But as said, part of your bonk likely came from lack of saddle time. Once you get a few more base miles in your legs the distance will come a bit easier.