Skip to content
Discussion options

You must be logged in to vote

both is "ok". you can call an API in beforeLoad and you can also throw a redirect in a loader.

you just need to understand the consequences:

when you navigate to /foo/bar/baz, this would for example match 3 nested routes (foo, bar, baz), then following happens:

  1. beforeLoad of all those routes run serially, so first foo's beforeLoad, then bar's beforeLoad, baz's beforeLoad
  2. loader of all those routes run in parallel. so if one loader throws a redirect, the other loaders would still execute!

Replies: 1 comment 1 reply

Comment options

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

Answer selected by mkarajohn
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