I would strongly suggest taking classes whenever you have the opportunity over self-teaching theory, because there is a lot of information to learn and it can be hard to figure out what you need to learn and when. Here's a decent
free little course that goes over a lot of the essentials you'd probably need to know to feel comfortable. If you feel like you need to learn more, look into the local community college class!
There is a point where theoretical knowledge will be less applicable to making dance music, so don't feel like you need to learn everything. A mastery of counterpoint might be really cool to apply to dance music, but it's definitely not necessary. Just absorb each new level of information as it comes - there's a lot of contradictions, a lot of "you don't do this, but later on you'll learn why you
do do this", and everything else that comes as a result of hundreds or thousands of people experimenting over centuries to figure out all this stuff.