Skip to content

Single Fetch and redirect utility deprecation #9385

Closed 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: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@brophdawg11
Comment options

@janhesters
Comment options

Answer selected by caprica
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants