Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么装饰器不能用于函数? #98

Open
Lawguancong opened this issue Oct 8, 2021 · 0 comments
Open

为什么装饰器不能用于函数? #98

Lawguancong opened this issue Oct 8, 2021 · 0 comments

Comments

@Lawguancong
Copy link
Owner

Lawguancong commented Oct 8, 2021

装饰器只能用于类和类的方法,不能用于函数,因为存在函数提升。
原因:函数提升
解决方法:高阶函数HOF (HOC是高阶组件)

https://www.bookstack.cn/read/es6-3rd/spilt.3.docs-decorator.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant