DEV Community

Discussion on: RxJS with React: Actions and Subjects

Collapse
 
robertlagrant profile image
Robert Grant • Edited

This is really great. Thank you. Two small things:

1) the paging example only works for me if I go to the example site directly
2) I didn't really understand the use of scan's default of 1 in the getUserNames example, where you also had to use startWith(1) - I assume it's because you need a value even before the first event is emitted, but it took a little research of my own to hit that.

Thank you again!

Rob

Collapse
 
bigab profile image
Adam L Barrett

Yeah that’s a bit of a hack but, I wanted the state to be there (1) immediately on subscribing so i needed the startsWith(1), but the scan will wait for 2 events if you don’t provide a default value, so by providing it and the startWith it works