Are electric cars really better for the environment?

I always see conflicting information about electric cars so I’m truly curious. Wouldn’t charging the car still use natural resources for the electricity? 80% of our energy comes from natural resources so would it only be 20% less? I’ve also heard that mining for lithium ion batteries are super harmful to the environment, so is it really better in all? How many miles would I have to drive to make the car better for the environment than a gas powered car?