TanStackT
TanStack10mo ago
3 replies
rubber-blue

beforeLoad -> loader question

Hi all.

I've been enjoying the Router but I have a quick question.

In beforeLoad I make a check if context has a key value pair and I fetch the data and store it to the context.

In the next step I use the loader to check the value from the beforeLoad context save to decide if I'm redirecting the user to a top level page ( change-password ).

Is this the preferred / correct way of doing this?

Since I can't redirect in the beforeLoad since the context would not be stored if I redirect there.

Any comments on this approach? Is there a better way of doing it? Is there something like an additional pipe like afterBeforeLoad?

Cheers!
Was this page helpful?