Resistor is basic component that is used in all the electronic circuits. It is a passive element that resists the flow of electrons. Thus it allows only certain amount of current to pass through it. Remaining current is converted into heat.
The working principle of bulb is that electricity is passed through the filament usually tungsten, which is a resistor. The energy is converted to and released as light and heat.