A thermoresponsive hydrogel, poly(N-isopropylacrylamide) (poly(NIPAM)), is synthesized in situ within an oxidized porous Si template, and the nanocomposite material is characterized. Infiltration of the hydrogel into the interconnecting nanoscale pores of the porous SiO2 host is confirmed by scanning electron microscopy. The optical reflectivity spectrum of the nanocomposite hybrid displays Fabry–Pérot fringes characteristic of thin film interference, enabling direct, real-time observation of the volume phase transition of the confined poly(NIPAM) hydrogel. Reversible optical reflectivity changes are observed to correlate with the temperature-dependent volume phase transition of the hydrogel, providing a new means of studying nanoscale confinement of responsive hydrogels. The confined hydrogel displays a swelling and shrinking response to changes in temperature that is significantly faster than that of the bulk hydrogel. The porosity and pore size of the SiO2 template, which are precisely controlled by the electrochemical synthesis parameters, strongly influence the extent and rate of changes in the reflectivity spectrum of the nanocomposite. The observed optical response is ascribed to changes in both the mechanical and the dielectric properties of the nanocomposite.