3 ms·
The hook functions need the knowledge that the mount and update are doing the same thing. However, the example would be more complete if the mount was doing som
by daok 7y ago
The hook functions need the knowledge that the mount and update are doing the same thing. However, the example would be more complete if the mount was doing something different. In that case, not only the class example would be more clear to read with explicit function for mount and update but also would be similar in terms of the line of code. With Hooks, if you want something different you need to do a "trick" which is less obvious than defining `componentDidMount`.
I am not against Hooks, but I do not believe the example portrait the situation properly.