In RxJS, there are two ways to use operators - as pipeable operators or patch operators. The key difference between them is in how they are imported and used in code. Pipeable operators are the recommended way to use operators in RxJS since version 5.5. Pipeable operators are imported as standalone functions and are then used in a pipeline by chaining them together with the `pipe()` function. Pipeable operators are pure functions that take an observable as their input and return a new observable as their output, allowing multiple operators to be composed together to form a pipeline.

Here's an example of using pipeable operators to transform an observable:


import { of } from 'rxjs';
import { map, filter } from 'rxjs/operators';

const source$ = of(1, 2, 3, 4, 5);

const filtered$ = source$.pipe(
  filter(value => value % 2 === 0),
  map(value => value * 2)
);

filtered$.subscribe(
  value => console.log(value), // Output: 4, 8
  err => console.error(err),
  () => console.log('Complete')
);

In this example, the `filter()` and `map()` operators are imported as standalone functions and then used in a pipeline with the `pipe()` function to create a new observable. The `filter()` operator is used to only allow even values to pass through, and the `map()` operator is used to double the remaining values. Patch operators, on the other hand, were the original way to use operators in RxJS prior to version 5.5. Patch operators are imported as methods on the `Observable` class and are then used by calling them directly on an observable. Patch operators modify the behavior of the observable instance they are called on, and cannot be composed together in the same way as pipeable operators.

Here's an example of using patch operators to transform an observable:


import { of } from 'rxjs';

const source$ = of(1, 2, 3, 4, 5);

const filtered$ = source$
  .filter(value => value % 2 === 0)
  .map(value => value * 2);

filtered$.subscribe(
  value => console.log(value), // Output: 4, 8
  err => console.error(err),
  () => console.log('Complete')
);

In this example, the `filter()` and `map()` operators are called directly on the `source$` observable instance, which modifies its behavior to only allow even values to pass through and double the remaining values. Patch operators can still be used in RxJS, but pipeable operators are recommended for their increased composability and modularity.