Skip to content

Single Fetch and redirect utility deprecation #9385

Answered by kiliman
caprica asked this question in Q&A
Discussion options

You must be logged in to vote

throw redirect or throwing any Response is still an acceptable pattern. You just don't want to return responses directly because Single Fetch doesn't know how to interpret the response body.

Don't worry about setting the response stub status and headers for these as you can add those directly. The only time you need to use the response stub is if you're returning a naked object.

throw redirect('/', { status: 301, headers: { ... } })

You still need to return a Response directly in Resource Routes since Remix doesn't process the response. It simply sends it as-is to the client.

Replies: 1 comment 1 reply

Comment options

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

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