This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EmailInput extends Component { | |
| state = { | |
| email: this.props.defaultEmail, | |
| prevPropsUserID: this.props.userID | |
| }; | |
| static getDerivedStateFromProps(props, state) { | |
| // Any time the current user changes, | |
| // Reset any parts of state that are tied to that user. | |
| // In this simple example, that's just the email. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const user = { | |
| id: 1, | |
| name: 'Hugo', | |
| friends: [3, 5, 22] | |
| }; | |
| test('user 3 should be a friend of user', () => { | |
| expect(user).toEqual( | |
| expect.objectContaining({ | |
| friends: expect.arrayContaining([3]) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test('id and productName should match', () => { | |
| const obj = { | |
| id: '111', | |
| productName: 'Jest Handbook', | |
| url: 'https://jesthandbook.com' | |
| }; | |
| expect(obj).toEqual( | |
| expect.objectContaining({ | |
| id: '111', | |
| productName: 'Jest Handbook' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('contains test', () => { | |
| it('should return true', () => { | |
| const arr = [ { a: 1 }, { b: 2 }, { c: 3 } ] | |
| expect(arr).toContainEqual( // Compare values only. | |
| { b: 2 } | |
| ) | |
| }) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Twitter Auto Translator | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://twitter.com/* | |
| // @grant none | |
| // ==/UserScript== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shoplooks is an exclusive | |
| integrated marketing agency | |
| for bloggers, influencers | |
| And content creators sharing what they love and helping the world's | |
| best brands reach new audiences and enhance awareness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Foci https://click.shoplooks.com/4mmh/61 | |
| 苹果手表6代(银40+铝合金+白单圈表带3号)https://click.shoplooks.com/45C4/61 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const [value, setValue] = useState(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function App() { | |
| const [todos, setTodos] = useState([ | |
| { id: 1, title: "Selectus aut autem", completed: false }, | |
| { id: 2, title: "Luis ut nam facilis et officia qui", completed: false }, | |
| { id: 3, title: "Fugiat veniam minus", completed: false }, | |
| { id: 4, title: "Aet porro tempora", completed: true }, | |
| { id: 5, title: "Laboriosam mollitia et enim quasi", completed: false } | |
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { React, ReactDOM } from "https://unpkg.com/es-react@16" | |
| import htm from "https://unpkg.com/htm?module" | |
| const html = htm.bind(React.createElement) |