Technology Radar
Last updated : Oct 27, 2021
NOT ON THE CURRENT EDITION
This blip is not on the current edition of the Radar. If it was on one of the last few editions, it is likely that it is still relevant. If the blip is older, it might no longer be relevant and our assessment might be different today. Unfortunately, we simply don't have the bandwidth to continuously review blips from previous editions of the Radar.
Understand more
Oct 2021
Adopt
React Hooks 引入了一种管理状态逻辑的新方法;鉴于React组件相比较类来说更接近于函数,Hooks接受了这一点并将状态传给函数,而不是将函数作为方法传给带有状态的类。React应用中状态管理的另一个主要内容是 Redux ,我们注意到它已经受到审查,可以看到,在某些时候Redux的复杂性并不值得,对于这些情况,使用Hooks的简单方法是更可取的。完全靠自己去引入这种实现很快会变得棘手;因此我们推荐考虑结合 React Context 以及useContext和useReducer Hooks,并根据这篇 博客文章 中解释的路线来实现。
May 2020
Adopt
React Hooks 引入了一种管理状态逻辑的新方法; 鉴于 React 组件相比较类来说更接近于函数, Hooks 接受了这一点并将状态传给函数,而不是将函数作为方法传给带有状态的类。 基于我们的经验,Hooks 提高了组件之间功能的重用性和代码的可读性。 考虑到 Hooks 使用 React Test Renderer 和 React Testing Library改进了可测试性,以及不断增长的社区支持,我们将其作为我们的首选方法。
Nov 2019
Trial
今年年初,React Hooks成为了流行的JavaScript框架。它无需编写类就可以使用状态和其他React功能,从而提供了一种比使用高阶组件或render-props更简洁的方法。诸如Material UI和Apollo之类的库已经切换到使用Hooks了。测试Hooks时会遇到一些问题,特别是使用Enzyme时,这能帮助我们重新评估是否选择Enzyme作为工具。
Published : Nov 20, 2019