The noble gases are unreactive because their atoms have stable arrangements of electrons. Atoms of other elements can achieve stable electronic structures by gaining or losing electrons to form ions, or by sharing electrons to form covalent bonds.
The atoms of elements in Group 1 lose their single outer electron, for example soduim Na (2,8,1) forms sodium ions, Na+ (2,8).
The atoms of elements in Group 7 gain one electrom to form ions, for example chlorine Cl (2,8,7) forms chloride ions, Cl- (2,8,8).
We can show this transferring of electrons using cross diagrams. Positive and negative ions attract and form ionic bonds.