How long did you breastfed?

This is my first child how long should i breastfeed? She was on formula for about 2 days bc my milk supply went low for whatever reason and it made her face red and swollen and she was very very gassy and cranky....im trying to avoid formula for as long as possible bc i hate how it makes my little one feel. How long do babies even drink milk for?