In this tutorial, we will learn about the Tap Operator of RXJS.

What is Tap Operator?

The tap Operator is a Utility Operator which is very similar to a helper function,  

Perform a side effect for every emission on the source Observable, but return an Observable that is identical to the source.

The tap operator allows you to perform actions or side effects on an Observable stream without modifying or altering the original stream.

const arr = [1, 2, 3];

const fromArr$ = from(arr);

fromArr$
  .pipe(tap((value) => console.log("Received value: ", value)))
  .subscribe((value) => console.log(`Emitted Values: `, value));

Use of Tap Operator

1.Console log(data)

2. Change Property Value

3. Emit Value in Observable

4. Perform Any Other Action

Instead of doing other like unsubscribing in map better to do it in tap

Topics covered:

Found this article helpful?

TutsCoder tutorials are free and ad-light — supported by readers like you. Buy me a coffee (or two ☕☕) as a token of appreciation and help keep Angular & Node.js content coming!

One-time. No subscription. 100% optional. 🙏 Every coffee counts!

Leave a Comment

Your email will not be published. Spam-free zone. ✌️

Available for Projects

Need Help With Your
Angular or Node.js Project?

7+ years of MEAN Stack experience. I build scalable Angular 21 apps, Node.js APIs, and SaaS products — delivered on time, every time.

7+ Years MEAN Stack Angular 21 + Nx Expert 20+ Projects Delivered Remote / Freelance