When a component made up of atoms that conveniently reduce electrons (a metallic) reacts with a component composed of atoms that readily gain electrons (a nonmetal), a transfer of electrons usually takes place, manufacturing ions. The compound formed by this transfer is stabilized because of the electrostatic points of interest https://cyanolab.net/how-to-order/