Resonating valence bond (RVB) states are a class of entangled quantum many body wavefunctions with great significance in condensed matter physics. We propose a scheme to synthesize a family of RVB states using a cavity QED setup with two-level atoms coupled to a common photon mode. In the lossy cavity limit, starting with an initial state with M atoms excited and N atoms in the ground state, we show that this setup can be configured as a Stern Gerlach experiment. A measurement of photon emission collapses the wavefunction of atoms onto an RVB state composed of resonating long-ranged singlets. Each emitted photon reduces the number of singlets by unity, replacing it with a pair of lone spins or 'spinons'. As spinons are formed coherently in pairs, they are analogous to Cooper pairs in a superconductor. To simulate pair fluctuations, we propose a protocol in which photons are allowed to escape the cavity undetected. This leads to an inchoate superconductor -mixed quantum state with a fluctuating number of spinon pairs. Remarkably, in the limit of large system sizes, this protocol reveals an underlying quantum phase transition. Upon tuning the initial spin polarization, the emission exhibits a continuous transition from a dark state to a bright state. This opens an exciting route to simulate RVB states and superconductivity.