IPhone 10 showing apple logo then turning off when I attempt to charge?

My iPhone s battery died last night and I plugged it in to charge it this morning. When I plug it in, the Apple logo shows for a few seconds then the phone switches itself off. It constantly does this and doesn't actually seem to charge despite being plugged in. What do I do?

Added (1). EDIT - to confirm, no matter how long I leave the phone charging, it still keeps flashing on the apple logo screen then realising it doesn't have enough power to boot up, so quickly shuts off again.

Just leave it plugged in. It'll eventually get enough charge to start up.

Leave it connected for at least two hours (it probably has been by now) then do a hard reset, with it still connected to power:

Briefly press volume up then volume down.
Then hold the power button pressed for 10 - 15 seconds, until the Apple logo reappears.

It's a common occurrence with phones and tablets if the battery goes flat to the point they stop working - the content of the RAM is lost, so when the phone tries to "wake up" and continue running whatever it was, it just crashes instantly.
The fast change circuits are also software controlled, so charging is also extremely limited in that state to avoid battery damage.

The button reset sequence forces a "cold reboot", clearing the RAM and starting everything from scratch, as if it had previously been properly turned off.

Nothing is deleted.

(For older iphones it's both power and home buttons at the same time; for android devices, usually power and volume up at the same time).

Yeah then its probably not good