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
【Q013】有没有使用过 react hooks,它带来了那些便利 #14
Comments
依我的看法, 目前使用感觉最爽的两个hook,都是关于请求的。一个是 |
1.HOC嵌套地狱 |
个人最喜欢的两个点 |
不用去写生命周期了 |
1.类组件比起函数组件更难以理解。 2.无需修改组件结构的情况下复用状态逻辑,状态管理更加清晰。 3.不用写类函数就可以使用更多的 React 特性。 4.更符合 React 本身的思想,函数式、组件化。 5.组件树层级变浅 (原本的HOC/render props 等方式增加了组件树层数及渲染,在 React DevTools 中观察过 React 应用,你会发现由 providers,consumers,高阶组件,render props 等其他抽象层组成的组件会形成“嵌套地狱”,这些功能都可以通过强大的自定义的 Hooks 来实现。) 6.不用再去考虑 this 的指向、生命周期问题。 |
有没有使用过 react hooks,它有哪些优缺点?
The text was updated successfully, but these errors were encountered: