Saline hydrides (i.e., NaH, LiH, etc.) react with water to form a base and hydrogen gas.
The chemical equation used to represent the reaction can be written as:
The reaction is violent and produces fire. CO2 is heavier than dioxygen. It is used as a fire extinguisher because it covers the fire as a blanket and inhibits the supply of dioxygen, thereby dousing the fire. CO2 can be used in the present case as well. It is heavier than dihydrogen and will be effective in isolating the burning surface from dihydrogen and dioxygen.