I have an epic works well with concat operator. Webstorm starts saying it is deprecated in the way I use it. Says
deprecated export function concat<{type: string}[]>( v1: {type: string}[], scheduler: SchedulerLike): Observable> Use scheduled and concatAll (e.g. scheduled([o1, o2, o3], scheduler).pipe(concatAll())
Can't figure out, how to rewrite this code?
const epic = action$ => action$.pipe(
ofType(TYPE),
mergeMap(() =>
concat(
of({type: 'START'}),
ajax.getJSON('someurl').pipe(
mergeMap(serverResponse => ([
{type: 'LOADED'},
{type: 'DO_JOB', serverResponse}
]))
)
)
)
Use concatWith. concatWith is actually not a completely new operator. It’s only meant to replace the concat operator which is currently marked as deprecated and will be removed in v8.
There’s one subtle difference between the two, though. concatWith only accepts inputs of type ObservableInput, whereas concat can also take a scheduler.
More details can be found here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With