Sandbox: codesandbox.io/s/wonderful-wescoff...
Currently, I have tried to use state to set the page and pageSize, but it will stuck in an infinite loop
Hmm you could try setting the resource in state, so that when you update it (via a transition) it triggers a rerender. For example with your code, something like this. I added some comments to explain what's going on as well. Hope it helps!
Also, in case you haven't already, I'd suggest looking into react-query. It handles refetching on mutation automatically for you and has built in support for Suspense Data Fetching (enabled via a config option).
I have read about react query, swr with suspense, but I want to learn suspense natively so I try not to use those library.
Btw, thank for your support, I really appreciate it
Sandbox: codesandbox.io/s/wonderful-wescoff...
Currently, I have tried to use state to set the page and pageSize, but it will stuck in an infinite loop
Hmm you could try setting the
resourcein state, so that when you update it (via a transition) it triggers a rerender. For example with your code, something like this. I added some comments to explain what's going on as well. Hope it helps!Also, in case you haven't already, I'd suggest looking into react-query. It handles refetching on mutation automatically for you and has built in support for Suspense Data Fetching (enabled via a config option).
I have read about react query, swr with suspense, but I want to learn suspense natively so I try not to use those library.
Btw, thank for your support, I really appreciate it
That's a great approach! Just thought I'd mention it in case you were unaware 🤙
& no thanks needed! Glad I could help 🙌