加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码门户网 (https://www.92codes.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Windows > 正文

2019年,React开发人员应该掌握的22种神奇工具

发布时间:2019-11-01 21:43:43 所属栏目:Windows 来源:LeanCloud
导读:副标题#e# 众所周知,React 是 JavaScript 库,用于构建出色的用户界面。但是,并不是每个人都在使用相同的工具或都知道所有有用的工具,这些工具有助于使 React 开发体验更有趣,更主动。 如果大家还没使用 React ,或者你有对它感兴趣的朋友,当他们问你

以下是使用此库进行测试的示例代码:

  1. // Hoist helper functions (but not vars) to reuse between test cases  
  2. const renderComponent = ({ count }) =>  
  3.   render(  
  4.     <StateMock state={{ count }}>  
  5.       <StatefulCounter />  
  6.     </StateMock>,  
  7.   )  
  8. it('renders initial count', async () => {  
  9.   // Render new instance in every test to prevent leaking state  
  10.   const { getByText } = renderComponent({ count: 5 })  
  11.   await waitForElement(() => getByText(/clicked 5 times/i))  
  12. })  
  13. it('increments count', async () => {  
  14.   // Render new instance in every test to prevent leaking state  
  15.   const { getByText } = renderComponent({ count: 5 })  
  16.   fireEvent.click(getByText('+1'))  
  17.   await waitForElement(() => getByText(/clicked 6 times/i))  
  18. }) 

8. React Developer Tools

React Developer Tools 是一个扩展插件,它允许在 Chrome 和 Firefox 开发人员工具中查看 React 组件层次结构。

这是 React 开发中最常见的扩展插件,并且是 React 开发人员用来调试其应用程序的最有用的工具之一。

9. Bit

(编辑:源码门户网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!