Rename Tap operator to SideEffect #7346
Closed
MeddahAbdellah
started this conversation in
Ideas / Feature request
Replies: 1 comment
-
This operator has been renamed once in the past, please check the Renamed Operators section here. I don't think it would be wise to rename it once again. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The goal of RxJS is to provide a way to code reactively, in a more declarative way. Yet most developers, especially Fullstack developers come from an imperative world. This often leads to using
tap
to assign their values from inside the pipe to a variable outside the pipe and use that variable imperatively which is actually a side effect which is mainly what tap lets you do.This operator is perfect when you want to trigger a notification or a toaster when a certain event happens, unfortunately, I have seen it used many times to assign a value to a variable outside the pipe.
My suggestion here is simply to rename
tap
tosideEffect
to make it more explicit that this operator should be used for this purpose.However I might not be on the right track here and tap should be used in other contexts that I am overlooking, in which case I would love to know how else it could be used and if I am the only one seeing it used everywhere for a purpose it is not meant for.
Beta Was this translation helpful? Give feedback.
All reactions