A dot and cross diagram for sodium chloride suggests that it is made up of pairs of sodium and chloride ions. It is not. A 3D construction model shows how the ions are arranged in a lattice structure.
This energy overcomes the strong electrostatic forces of attraction which act in all directions between the oppositely charged ions: The strength of the ionic bonds depends on the charge on the ions.