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 form 'react' | |
| // ... | |
| class MyDebouncedComponent extends React.Component { | |
| // ... | |
| debouncedOnChange({ param1, param2 }) { | |
| clearTimeout(this.timer); | |
| this.timer = setTimeout(() => { | |
| // logic... |
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
| myVar += 1 | |
| console.log(myVar) | |
| if (false) { | |
| var myVar = 3 | |
| } else { | |
| //nothing here | |
| } | |
| myOtherVar += 1 |
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
| export default function register() { | |
| if ('serviceWorker' in navigator) { | |
| const publicUrl = new URL(process.env.PUBLIC_URL, window.location); | |
| if (publicUrl.origin !== window.location.origin) { | |
| return; | |
| } | |
| window.addEventListener('load', () => { | |
| const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; |
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 flatten = arr => { | |
| let flattenedArr = [] | |
| let finished = true | |
| for (const iterator of arr) { | |
| if (!Array.isArray(iterator)) { | |
| flattenedArr.push(iterator) | |
| } else { | |
| flattenedArr = flattenedArr.concat(iterator) |