The optical counterparts of γ-ray bursts