Stability of reaction–diffusion systems with stochastic switching