Algebraic Effects for React Developers
I&#x27;ve read a bit about algebraic effects in the past (independent of React), but I think they are much harder to grok than hooks. I tried many times but I never really got it. Like Haskell has this way of making you think you&#x27;ve got it for a split second, then you try to do something and you realise you don&#x27;t have a clue. The effect systems using free monads seem to keep applying a functor to itself an unlimited amount of times and I really didn&#x27;t get it. I even did that category theory youtube course for programmers. Still don&#x27;t get it. I could probably get it if I went full time on just that for 2 months or so, then coded in that style for a year to really bed it in.<p>Anyway...<p>However I don&#x27;t find hooks that hard to understand. I don&#x27;t think you need to touch algebraic effects to get it. It&#x27;s yet another view system (like having done windows forms, wpf, asp.net webforms, mvc, knockout js, RX, etc.) to get your head around how it works.<p>In this case you have a function that returns the desired state and with useEffect you can set up actions to be run after that view gets rendered and added to the DOM, with some conditions on which renders you are interested in (all of them? just when foo changes?). And another callback for when you are &quot;done&quot; so you can clean up.