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
import { useRef, useInsertionEffect, useCallback } from 'react'; | |
// The useEvent API has not yet been added to React, | |
// so this is a temporary shim to make this sandbox work. | |
// You're not expected to write code like this yourself. | |
export function useEvent(fn) { | |
const ref = useRef(null); | |
useInsertionEffect(() => { | |
ref.current = fn; |