I am using angular 10 and using Renderer2 to add and remove classes:
this.renderer.removeClass(this.document.body, 'signin-user');
this.renderer.addClass(this.document.body, 'anonymous-user');
Does Renderer2 let me replace a class. For e.g if "signin-user" is applied replace it with "anonymous-user" and vice-versa instead of writing the removeClass function.
You can check this out here