Skip to content

Instantly share code, notes, and snippets.

View Leejjon's full-sized avatar

Leon Liefting Leejjon

View GitHub Profile
export interface MyInputHandles {
focus(): void;
}
const MyInput: RefForwardingComponent<MyInputHandles, MyInputProps> = (
props,
ref
) => {
const inputRef = useRef<HTMLInputElement>(null);
import MyInput, { MyInputHandles } from './MyInput';
const Autofocus = () => {
const myInputRef = useRef<MyInputHandles>(null);
useEffect(() => {
if (myInputRef.current) {
myInputRef.current.focus();
}
});
@AlemTuzlak
AlemTuzlak / gist:9ecd385e7e3b57ba80c36914123800e8
Created March 2, 2024 11:12
react-query adapter for remix
import { QueryClient } from "@tanstack/react-query";
import { CacheAdapter, createCacheAdapter } from "remix-client-cache";
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60 * 5,
},
},
});