useSWRInfinite
to fetch all pages
#2922
Unanswered
RenaudAubert
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'm trying to fetch all the pages for a particular resource to display a Plotly graph.
Here's what I've done (this is a summary of my code below):
setSize(size + 5)
if neededThis method is giving me an error
I've used this section of the React doc to create this code but it looks like it only works if the value is a prop not a state from another hook.
I tried to move the
setSize
condition inside auseEffect
but I'd have to usesize
inside the effect which whould cause too many renders and API calls if I provided the dependency array correctly. If I don't usesize
and only use a functional update withsetSize((prevSize) => ...)
then my effect would only run once.Please let me know if you need more details. Any help would be greatly appreciated.
Cheers,
Renaud
Beta Was this translation helpful? Give feedback.
All reactions