I’ve never liked electric hot water heaters as a lot of energy is lost in transmission from the generating source, but I’ve made an exception for this little 2-1/2 gallon hot water heater that goes under the sink of our office kitchen. It has a switch that I turn on for maybe an hour, then turn off. The water temperature can be set with the thermostat. The tank is well insulated, so it stays hot for hours. It seems a very efficient use of electricity.
In the house, we’ve had a 5-gallon electric water heater under the kitchen sink for about 15 years. It’s minimal in electric power usage, and doesn’t waste water getting from cold to hot (in pipes coming from a more distant water heater). And yes, I’ve got to get more of our water heated by the sun. It’s on my list of things to do, honest.