Definitely learn as you go, but definitely learn the basics. Knowing a bit of music theory will let you break out of being stuck (at times) when composing a song. Understanding cord progressions will help you know WHY it doesn't sound right. For example I may have a chord progression in C major that the last chord doesn't sound right, and I would immediately look to see if the last chord is a B or G and try changing it to that because I know B and G are subdominant chords that finish well into C.
There's a lot of electronica out there that (IMHO) doesn't have much of a melody or harmony. It's just a bunch of drums and loud basslines. I don't really connect with that type of music. I enjoy the enormous bass drop, but I also like to connect with the music emotionally. Knowing music theory will really help you create emotional music when you're composing. You will want to be able to create both emotional and energetic music.
I think that at any given point in a song you are on a continuum with Energetic on one side and Emotional on the other. Knowing the theory lets you more easily place the dot where you want to.
I agree with the point that applying too much music theory to tracks can ruin them. If it sounds good: do it! If it doesn't, don't. There are often good reasons to break the rules. Music is art.
I'll also add these two tutorials:
5 Steps to Writing Better Music Faster
The first one I posted because it's important to think about composition and music theory mostly only in the first stage of music production: composition. Once you're in the production stage of your track, you generally shouldn't need to think about music theory.
Also, if you're really interested in theory, this can help:
Circle of Fifths Chords Tutorial and File