News for hackers. Stuff that matters.
Re:Why Would Anyone Need JavaScript Generator Functions? by sktrdie on Monday November 07, 2022 @01:20PM (#33509815)
First of all, sagas are an amazing concept that I still cherish even if I don’t use them anymore (hype not there?).

Regarding the hooks comment I’m not sure I follow. Surely components are also idempotent (if you skip useEffect) and should be replayable - that’s at least how I think react refresh can manage to keep state intact during file changes in development.

Anyway I still very much value the concepts behind sagas so thanks for great work.

Re:Why Would Anyone Need JavaScript Generator Functions? by qudat on Tuesday November 08, 2022 @10:26AM (#33519999)
> Regarding the hooks comment I’m not sure I follow. Surely components are also idempotent (if you skip useEffect) and should be replayable - that’s at least how I think react refresh can manage to keep state intact during file changes in development.

We used to have the concept of smart and dumb components, with dumb components we could test if we provide X props we could determine Y result and write tests expecting Y to be true. Now with the advent of hooks, side-effects are much more likely to be in all of our components. This makes react components impure and difficult to test as individual units. This movement started primarily with the shift to hooks.

> Anyway I still very much value the concepts behind sagas so thanks for great work.

Thanks!