Traverse objects and arrays
Traverse the object: for…in loops through the object’s own and inherited enumerable properties Loops through the object’s own and inherited enumerable properties (excluding Symbol properties). 123
Derek Zhu
Traverse the object: for…in loops through the object’s own and inherited enumerable properties Loops through the object’s own and inherited enumerable properties (excluding Symbol properties). 123
Promise.all() and Promise.allSettled() Promise.all and Promise.allSettled are both methods for handling multiple concurrent Promises, but they differ in how they handle successful and failed Promis
Promise: A new solution for asynchronous programming introduced in ES6. Promises are mainly to solve the previous problem of callback hell. Promise is a constructor that encapsulates an asynchronous
render() rerender is used to simulate props changing. How to get rerender(): 1const {rerender} = render(<FavoriteNumber />); rerender() uses and passes parameters rerender() is u
Format expect(A).ValidateItem() is used in React testing library and Jest to verify functionality. Expect() Assertion Summary 1 [Expect() Assertion Summary 2](https://www.w3cschool.cn/jest_cn/ jest
fireEvent fireEvent was originally in the @testing-library/dom package, but @testing-library/react rewrote it and gave it additional React-specific functionality. It can simulate user acti
Aria-label try not to use role and aria-label in css. It’s all about accessibility. aria-label="cancelbtn", will read cancelbtn directly. So aria-label is for reading. If there is no aria-
Simple reusable rendering method In this method, we pass in the component as a parameter: 12345function render(ui) { const div = document.createElement('div') ReactDOM.render(<Fa
A simple test example 1234567891011import React from 'react'import {FavoriteNumber} from '../favorite-number'import ReactDOM from 'react-dom'test('render
Install 1npm install --save-dev @testing-library/dom After installation, the setupTests.js file will be generated under src. unit test file location The unit test file can be placed in the s