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
interface Props<TParams> { | |
params: TParams, | |
path: string, | |
children: React.ReactChild, | |
} | |
const CustomLink = <TParams extends any>(props: Props<TParams>) => { | |
const { | |
path, | |
params, |
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 { useEffect } = require("react"); | |
// Suffers from Stale Closures | |
export function useUpdatedExit(props) { | |
// initial = 0, latest = 0 | |
// initial = 0, latest = 1 | |
// initial = 0, latest = 2 | |
const { initial, latest, cb } = props; | |
function handleExit() { |
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 sleep(duration, shouldFail) { | |
return new Promise((resolve, reject) => { | |
const cb = shouldFail ? reject : resolve; | |
setTimeout(() => cb(), duration); | |
}); | |
} |
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
var videoElem = document.querySelector('video'); | |
var audioCtx = new AudioContext(); | |
var source = audioCtx.createMediaElementSource(videoElem); | |
var gainNode = audioCtx.createGain(); | |
gainNode.gain.value = 5; | |
source.connect(gainNode); | |
gainNode.connect(audioCtx.destination); |
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 Actor({ name }) { | |
function sayHello() { | |
console.log('hello', name); | |
} | |
return ( | |
<button onClick={sayHello}> | |
Say Hello | |
</button> | |
); |
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
.redact { | |
background-color: #000 !important; | |
border-radius: 6px !important; | |
color: transparent !important; | |
filter: brightness(0) !important; | |
} |
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 toastProps = { | |
purpose: 'alert', | |
variant: 'success', | |
isClosable: false, | |
onClose: handleClose, | |
root: { | |
'data-testId': 'root-wrapper', | |
}, | |
content: { | |
id: 'main-toast', |
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 Tab = ({ id, children }) => ( | |
<Consumer> | |
{({ changeTab }) => <div onClick={() => changeTab(id)}>{children}</div>} | |
</Consumer> | |
); |
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 { render, fireEvent, screen, waitForElementToBeRemoved } from '@testing-library/react'; | |
import * as utils from './utils'; | |
jest.mock('./utils'); | |
const foodData = [ | |
{ | |
id: 'SM', | |
label: 'Sausage McMuffin', |