ech0x
2019-06-26 06:46:17 +08:00
“ Hooks are functions that let you “ hook into ” React state and lifecycle features from function components. Hooks don ’ t work inside classes — they let you use React without classes. (We don ’ t recommend rewriting your existing components overnight but you can start using Hooks in the new ones if you ’ d like.)”
我不懂 JavaScript,不过看这个描述应该是不一样的 hook 跟 react 生命周期有关。
python 的装饰器只是高级函数的语法糖而已。