React Query2 [react query] react query 사용시 주의점(invalidateQueries) react query의 캐싱된 데이터는 invalidateQueries를 통해 refetch 시킬 수 있다. When a query i invalidated whit invalidateQueries, tow things happen- It is marked as stale. This stale state overrides any staleTime configurations being used in useQuery or related hooks- If the query is currently being rendered via useQuery or related hooks, it will also be refetched in the background 나 또한 오래된 값을 갱신시키기 위해 해당 메서드를 사용.. Web/React 2024. 7. 3. [react-query] useMutation의 실행 순서? const [tempState, setTempState] = useState(1); const tempMutation = useMutation(data => console.log(tempState)) // 결과는 바뀐 state값이 적용됨 { setTempState(prev => { return prev + 1; }); tempMutation.mutate(); }}> test tempMutation의 파라미터로 직접 넘기면 당연히 상태 변화가 일어나지 않는다. 공부할게 많다.. Web/React 2024. 1. 9. 이전 1 다음