extract setNewContext to an addToMainContext method and use it in the components