We report the first transformation between crystalline vinylene-linked two-dimensional (2D) polymers and crystalline cyclobutane-linked three-dimensional (3D) polymers. Specifically, absorption-edge irradiation of the 2D poly(arylenevinylene) covalent organic frameworks (COFs) results in topological [2+2] cycloaddition cross-linking the π-stacked layers in 3D COFs. The reaction is reversible and heating to 200°C leads to a cycloreversion while retaining the COF crystallinity. The resulting difference in connectivity is manifested in the change of mechanical and electronic properties, including exfoliation, blue-shifted UV-Vis absorption, altered luminescence, modified band structure and different acid-doping behavior. The Li-impregnated 2D and 3D COFs show a significant ion conductivity of 1.8×10−4 S/cm and 3.5×10−5 S/cm, respectively. Even higher room temperature proton conductivity of 1.7×10-2 S/cm and 2.2×10-3 S/cm was found for H2SO4-treated 2D and 3D COFs, respectively.