Flickr/Yanki01
You'll find plenty of threads on Apple's support forums filled with people trying to figure out why their devices suddenly won't charge - to a computer, to a wall, anywhere.
Thankfully, it might be an easy fix.
Your iPhone or iPad might not be charging properly due to a foreign object blocking Apple's reversible lightning port - this can be a simple clog like lint, dust, or debris collected from your pockets or living space.
It's easy to get remove a clog from your iPhone or iPad's lightning port. Just turn off the device, grab a toothpick or open paperclip, and then gently insert that into the port to remove any lint you find.
You can also use a can of compressed air to blow out any junk that might be in there.
After you've cleaned out the lightning port, try turning your device back on and recharging it. If it's still charging too slowly, you might want to consider a new lightning cable depending on its condition, or it might be a software issue, so make sure you're up to date.
If there's no physical clog, there are plenty of other ways to save battery life on your iPhone.