The effect of diffusion on the global stability of equilibrium in reaction-diffusion systems. An application to a class of epidemic models