-
I am using Supabase. import useSWR, { useSWRConfig } from "swr";
const { mutate } = useSWRConfig();
import { supabase } from "src/lib/initSupabase";
import { fetcher } from "src/lib/fetcher";
useEffect(() => {
supabase
.from("comments")
.on("INSERT", () => {
mutate(COMMENT_API_URL);
}
})
.on("UPDATE", () => {
mutate(COMMENT_API_URL);
})
.subscribe();
};
}, []);
const { data: commentsData } = useSWR(COMMENT_API_URL, fetcher); |
Beta Was this translation helpful? Give feedback.
Answered by
ru88s
Apr 28, 2022
Replies: 1 comment
-
It worked. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ru88s
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It worked.