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
"use client"; | |
import { todosStore } from "@/store/todoStore"; | |
import { useSyncExternalStore } from "react"; | |
export default function AAA() { | |
const todos = useSyncExternalStore( | |
todosStore.subscribe, | |
todosStore.getSnapshot | |
); |
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 { useCallback, useMemo } from "react"; | |
import { useLocation, useNavigate, useSearchParams } from "react-router-dom"; | |
const _getAll = (urlSearchParams: URLSearchParams) => { | |
const ret: Record<string, string[]> = {}; | |
for (const [k, v] of urlSearchParams.entries()) { | |
if (ret[k]) { | |
ret[k].push(v); | |
} else { | |
ret[k] = [v]; |
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
<!DOCTYPE html> | |
<html lang="ko"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>무거운 계산</title> | |
</head> | |
<body> | |
<p>무거운 계산</p> |
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 { useEffect, useMemo, useRef, useState } from "react"; | |
function App() { | |
const data = Array.from({ length: 7 }); | |
const [positions, setPositions] = useState< | |
Array<{ left: number; top: number }> | |
>([]); | |
const containerRef = useRef<HTMLDivElement>(null); | |
const heights = useRef<Array<number>>( | |
Array.from({ length: 10 }, () => Math.random() * 801) |
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 { useCallback, useEffect, useRef } from 'react'; | |
export function useSupportBack(listening: boolean, onBack: () => void) { | |
const fnRef = useRef(onBack); | |
const memoizedCallback = useCallback(() => { | |
fnRef.current(); | |
window.removeEventListener('popstate', memoizedCallback); | |
}, []); | |
useEffect(() => { |
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 localItemContext, { | |
setLocalItemValue, | |
} from "#/context/localItemContext"; | |
import { useReactiveVar } from "@apollo/client"; | |
import { useCallback, useEffect } from "react"; | |
type UseReactiveLocalItemReturnType = <V>( | |
key: string, | |
defaultValue?: V, | |
) => [V, (value: V | ((prevState: V) => V) | null) => void]; |
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
#include <iostream> | |
#include <vector> | |
#include <queue> | |
using namespace std; | |
int solution(int N, vector<vector<int> > road, int K) { | |
int answer = 0; | |
int village[51][51]; | |
int INF = 10000 * 50; | |
bool visited[51]; |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
interface CombinedStatus<T> { | |
status: "IDLE" | "PENDING" | "SUCCESS" | "FAILURE"; | |
data: T | null; | |
} | |
function useApi<ApiResultType extends object, Payload>( | |
repoFunc: ( | |
payload: Payload | |
) => Promise<ApiResultType> | |
) { | |
const _repoFunc = useRef(repoFunc); |
NewerOlder