Skip to content

Instantly share code, notes, and snippets.

View dev-drprasad's full-sized avatar

Reddy Prasad D dev-drprasad

View GitHub Profile
function useMultiFetch<T>(args: [string, RequestInit][]) {
const [response, setResponse] = useState([] as [T | undefined, NS][]);
const ref = useRef([] as [T | undefined, NS][]);
const abortRef = useRef([] as AbortController[]);
useEffect(() => {
if (args.length === 0) return;
const lendiff = args.length - ref.current.length;
if (lendiff < 0) {
ref.current = ref.current.slice(0, lendiff);
@dev-drprasad
dev-drprasad / gist:abb721f490258b5165b143c5b193a9ec
Created December 23, 2020 07:19 — forked from moraes/gist:2141121
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}