This file contains 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
// Usage: | |
// Replace React.lazy(() => import('x')); | |
// with retryDynamicImport(() => import('x')); | |
import { ComponentType, lazy } from 'react'; | |
const MAX_RETRY_COUNT = 15; | |
const RETRY_DELAY_MS = 500; | |
// Regex to extract the module URL from the import statement |
This file contains 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 testCall(a) { | |
fakeFetch(a) | |
.then((response) => { | |
if (a === 'works' && typeof response.data !== 'object') { | |
setState(fallbackRes) | |
return | |
} |
This file contains 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
// Implement Queue in JS and store collection as Array ( use Array method for add and remove items ) | |
class Queue { | |
constructor() { | |
this.collections = []; | |
} | |
enqueue(item) { | |
this.collections.push(item); |
This file contains 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
// left-to-right | |
<html lang="en" dir="ltr"> | |
// right-to-left | |
<html lang="ar" dir="rtl"> | |
// Customize with CSS | |
html:lang(ar) { |