|
|
|
|
|
by Cthulhu_
1551 days ago
|
|
Alright so, reading through all this I think I can summarize it: - Hooks are tricky because you need to pass them an array of dependencies, which is manual housekeeping - You shouldn't pass anything but primitives to a hook's dependency array if at all possible What is the alternative? Just pay attention to the two above, or go back to class based components? Or will there be a React-flavored JS/TS (like JSX / TSX) that has different closure mechanics? |
|
Was there anything wrong with class components? It's what I learned half a decade ago, and the idea of a "state" object made so much sense. Now, with hooks and whatnot, it seems like React is trying to be "functional" without actually being so.