During my recent workouts, I've learned a few tips on how to prevent spasms while exercising. First, make sure to warm up properly and stretch before any activity. It's also important to stay hydrated and maintain proper electrolyte balance. Additionally, don't forget to listen to your body and know your limits to avoid overexertion. Finally, regular massages or foam rolling can help keep muscles relaxed and reduce the risk of spasms.