BJT NPN transistor as low side switch: Use voltage divider or in series resistor?
You, as the designer, should be considering two cases:

Am I driving the base sufficiently to drive the transistor into saturation while at the same time making sure that I don't either overdrive the base or my MCU's GPIO output specification?

Is the transistor going to be fully into cutoff when the output from the MCU is LOW or undefined, such as on power-up before the pin has been initialized as an output.


So the answer to 1 is usually just an Ohm's Law calculation based on the required current to switch the transistor on.
Number 2 can be a bit more complex due to the difference between a LOW on the output vs. whatever your specific MCU does at power-up.  You'll need to understand that and design your interface circuit between the MCU and the transistor accordingly.