-
My code here: Link The fallback is not displayed. What should I modify code? |
Beta Was this translation helpful? Give feedback.
Answered by
byseop
Nov 23, 2022
Replies: 1 comment
-
I found a solution. My hook to check the component of mount state here. import { useState, useEffect } from 'react';
const useMounted = () => {
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
return mounted;
};
export default useMounted; And my custom const mounted = useMounted();
const { data } = useGetPosts(
{
filter: JSON.stringify({ categories: selectedCategory })
},
{
suspense: true,
useErrorBoundary: true,
initialData: !mounted ? initialPosts : undefined
}
); If |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
byseop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found a solution.
After component mounted, remove the
initialData
.My hook to check the component of mount state here.
And my custom
useQuery
hook here.If
initialData
is exist,suspense
doesn't seem to be working well.Is there…