来源
https://composition-api.vuejs.org/#comparison-with-react-hooks# Comparison with React Hooks
The function based API provides the same level of logic composition capabilities as React Hooks, but with some important differences. Unlike React hooks, the setup() function is called only once. This means code using Vue's Composition API is:
1. In general more aligned with the intuitions of idiomatic JavaScript code;
2. Not sensitive to call order and can be conditional;
3. Not called repeatedly on each render and produces less GC pressure;
4. Not subject to the issue where useCallback is almost always needed in order to prevent inline handlers causing over-re-rendering of child components;
5. Not subject to the issue where useEffect and useMemo may capture stale variables if the user forgets to pass the correct dependency array. Vue's automated dependency tracking ensures watchers and computed values are always correctly invalidated.
6. We acknowledge the creativity of React Hooks, and it is a major source of inspiration for this proposal. However, the issues mentioned above do exist in its design and we noticed Vue's reactivity model happens to provide a way around them.