Heat a large skillet over medium heat and add the olive oil or butter.
Add the sliced onions and cook for 3 to 4 minutes, stirring occasionally, until soft and lightly translucent.
Add the sliced mushrooms to the skillet and spread them evenly in a single layer.
Let the mushrooms cook undisturbed for 2 to 3 minutes to allow browning.
Stir gently and continue cooking for another 4 to 5 minutes, until mushrooms are tender and lightly golden.
Season with salt and black pepper, adjusting to taste.
Add minced garlic (if using) during the last 30 to 60 seconds of cooking and stir briefly.
Remove from heat and serve warm.