Skip to content

How to handle errors in routes using createResource #171

Answered by ryansolid
manast asked this question in Q&A
Discussion options

You must be logged in to vote

There are 2 ways to look at this. You can handle the error automatically like retry logic in the fetcher of your resource. Resource takes a promise so doesn't matter what it is.

The other probably more common option is to handle it where it is read. Wrap with Error Boundary, or use the error property on the resource. You may also want to pass down the refetch option from the resource constructor if you want it to refetch.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@manast
Comment options

Answer selected by manast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants