Electromagnetic waves

Electromagnetic waves

James science teacher told him that space is full of vacuum. He asked his teacher than how light rays travel so long distances from stars and reach earth’s surface. Does not light needs matter to transfer energy? Can you explain the reason behind it?