#Diffrence between 'next : (res) => ' & ' (res) =>' in subscribe

3 messages · Page 1 of 1 (latest)

modern pulsar
#

Hi guys, i m having this doubt like how does

.subscribe({
 next : (res) => {..},
 error : (err) => {..},
})```
difference from this?
```js
.subscribe(
(res) =>{},
(err) => {}
)    ```
can anyone help me? thanks
opaque patrol
#

if I remember well, since RxJS 7 you should use next : (res) =>and the other form is deprecated.
the new approach is more flexible because you can choose the order of

next:
error:
complete:

idk if it has other advantages.
as a direct answer to you question: there is no difference, only old/new approach