Hydrogen vs. Battery Electric Cars

I've been thinking about something. A major issue with renewable energy is that if it isn't used or stored then its gone as we can't control how much the wind blows or how much sunlight we get. Storing as hydrogen would be a useful thing as it reduces the amount of Lithium and rare earth metals that need to be pulled out of the ground and shipped across the world to build battery complexes. Doing electrolysis to separate hydrogen from oxygen with the excess energy would simultaneously solve the storage issue and put in a form that can easily be used to reduce strain on the power grid (as the hydrogen can be used to power vehicles which would mean they don't need to be charging). Just a thought.