Skip to content
Discussion options

You must be logged in to vote

Yeah, so you have it within a click handler, and AFAIK, that's not gonna work.

The reason is the way the redirect function is designed.

In short, it is equivalent of throw new Error(/* something */), and as you know, when you throw an error as you render, you activate the closest Error Boundary:

In this case, that boundary checks if the error encountered, is a redirect error type, if not, then the boundary itself throws again, to propagate the error up the React tree. If it is a Redirect error, then it does the redirection. That's how it works in Clien…

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@pedro757
Comment options

@pedro757
Comment options

@pedro757
Comment options

@icyJoseph
Comment options

Answer selected by pedro757
@pedro757
Comment options

@icyJoseph
Comment options

@pedro757
Comment options

@inderps
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants