How can I refetch all the query key ? #6956
-
|
I want to refetch all the query key in the nextJs tho I've tried useEffect(() => {
// queryClient.invalidateQueries();
//queryClient.refetchQueries();
//queryClient.clear();
// All 3 of those don't work for me
}, [username]);This is how my query client look const [queryClient] = useState( () => new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
}),
);
//
I've also tried using it like this
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
});
//and this is how my useQuery Look const { data } = useQuery("repos", () => fetchRepoData(username));Is something wrong the things I'm doing and is there a solution for this . |
Beta Was this translation helpful? Give feedback.
Answered by
LinThitHtwe
Feb 23, 2024
Replies: 1 comment
-
|
I Finally got it,
// const { data } = useQuery("repos", () => fetchRepoData(username)); not this
const { data } = useQuery(["repos"], () => fetchRepoData(username)); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
LinThitHtwe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I Finally got it,
My query key should be an array instead of string