We numerically investigate optical afterglows from two-component jets under various configurations. Generally, the light curve is characterized by a rapid rebrightening when the observer is off-axis with respect to the narrow component, with the amplitude and peak time depending on detailed parameters. We further show that the optical afterglow of XRF 030723, especially its notable and rapid rebrightening, can be well explained by a typical two-component jet. This X-ray flash, together with GRB 030329, strongly hints toward the two-component jet model as a unified picture for X-ray flashes and gamma-ray bursts. With a narrow but ultra-relativistic inner outflow and a wide but less energetic outer ejecta, a two-component jet will be observed as a typical gamma-ray burst if our line of sight is within the angular scope of the narrow outflow. Otherwise, if the line of sight is within or slightly beyond the cone of the wide component, an X-ray flash will be detected.