3 ms·
Any function is a pure function if your consider the entire program state as your input and output.
by LudwigNagasena 4y ago
Any function is a pure function if your consider the entire program state as your input and output.
- satvikpendem 4y agoI see you've discovered the IO monad in Haskell.
- bayesian_horse 4y agoYou really don't need to give hooks access to some global variables (or all of them). You can, of course. But you would actually do that in a useEffect or use some setState in a callback somewhere. It's a cheap shot to complain that Javascript isn't a purely functional language... React can be used in a pretty pure way and if you don't you'll don't get the full benefit.