Transient polymer networks, where the crosslinks can dynamically break and re-form, combine the advantages of thermosets and thermoplastics; these transient networks can exhibit excellent mechanic and thermal properties as thermosets at low temperatures and can also be reprocessible at high temperatures as thermoplastics. In order to understand the viscoelastic properties of such materials, we develop a continuum theory of transient polymer networks where the crosslink dynamics are incorporated. This portable theory can be applied to understand the rheology of transient flexible or semiflexible polymer networks, such as stress relaxation, yielding, elastic-plastic transition, etc.