For corners with loose dirt or similar that reduce traction, the first thing is too look for a line that provides the best traction. Green colored stuff on the ground is better than brown. In some cases, dirt has better traction than dried grass (also brown).
Tire choice and pressure is important. Front tire should have more knobs than the back, since you don’t want it to wash out. If you are using clincher tires, don’t run your tire pressure too low, despite what you might hear about the pros running in their tubular or tubeless tiers. You don’t want to flat when you cross over the edge of a sidewalk. Depending on your weight, you probably want to run your tires somewhere in the range of 25-33 PSI, not too hard, but not super squishy.
For cornering, when you come into a loose corner, you want to shift your weight forward over the front wheel to help with traction. As you round the apex of the corner, shift your weight backwards so that you have more weight over the rear wheel, helping with traction as you apply power to exit the corner.