When do you use a hyphen?
Use a hyphen to connect two words or names.
The hyphen is often confused with the dash (which is represented by two hyphens in succession, or one really long hyphen). They have different functions. The hyphen connects two words (like nation-state) or names (Jonathan Rhys-Davies, for example, or Austria-Hungary). If you have to split a word to finish it on the next line, a hyphen indicates that it is still the same word.
Normally, there is no space before or after the hyphen, unless you have a pair or list of hyphenates where one word is used repeatedly ("Dada was an anti-war and anti-capitalism movement" becomes "Dada was an anti-war and -commerce movement." "The Avengers were a group of super-heroes and anti-heroes" becomes "The Avengers were a group of super- and anti-heroes").