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, QueryClientProvider, useMutation, useQuery } from "@tanstack/react-query"; | |
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; | |
import { debounce } from "lodash"; | |
import { useCallback, useEffect, useState } from "react"; | |
import './App.css'; | |
const queryClient = new QueryClient(); | |
// EX 1 - useQuery만 사용 | |
const fetchData = async (offset = 0) => { |
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, useRef, useState } from 'react'; | |
/* 설명: | |
React Strict mode를 해제한 상태에서 테스트해봤습니다. | |
1. 페이지에 Increase 버튼이 있음. 누르면 onClick 함수 실행됨 | |
2. 페이지가 렌더된 후, useEffect에서 setTimeout을 실행시킴. setTimeout은 2초 뒤 console에 출력함 | |
3. JSX에 각 값들이 (x.a = 일반 JS 객체, code = react의 state, s.current = useRef를 통해 받은 객체의 current 값) 표시되도록 되어있음 | |
*/ | |
export default function Home() { | |
const s = useRef(); |
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
const test = () => { | |
console.log('test') | |
} | |
test(); |