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 { QueryClient } from "@tanstack/react-query"; | |
import { CacheAdapter, createCacheAdapter } from "remix-client-cache"; | |
export const queryClient = new QueryClient({ | |
defaultOptions: { | |
queries: { | |
staleTime: 1000 * 60 * 5, | |
}, | |
}, | |
}); |
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 MyInput, { MyInputHandles } from './MyInput'; | |
const Autofocus = () => { | |
const myInputRef = useRef<MyInputHandles>(null); | |
useEffect(() => { | |
if (myInputRef.current) { | |
myInputRef.current.focus(); | |
} | |
}); |
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
export interface MyInputHandles { | |
focus(): void; | |
} | |
const MyInput: RefForwardingComponent<MyInputHandles, MyInputProps> = ( | |
props, | |
ref | |
) => { | |
const inputRef = useRef<HTMLInputElement>(null); |