More info here:
A transformer will work fine as long as it is rated for the load. But it’s easier and cheaper to buy a device that matches your mains voltage.