Re:React is becoming a black box
by beirut_bootleg on Thursday September 03, 2020 @06:19PM
(#24369535)
Just as you don't call this.componentDidUpdate in a loop. I'm reading through the comments and trying to figure out what mental model some have of React that causes them to just don't "get" hooks. I'm starting to think this difference in thinking did not start with hooks.
Re:React is becoming a black box
by tuesdayrain on Friday September 04, 2020 @11:23PM
(#24381184)
Hooks aren't always comparable to lifecycle methods. At my company every GraphQL query/mutation has a corresponding hook. There are frequently times when devs are tempted to use them, especially the mutations, in for loops.
Why would you call a hook inside a loop anyway? Hooks return callbacks and variables, which you can use inside a loop without problem.
[1]: https://reactjs.org/docs/hooks-rules.html#explanation