Skip to content

Can someone explain how exactly does the "LoadThenNavigate" case study work? #1414

Answered by mbrandonw
phi161 asked this question in Q&A
Discussion options

You must be logged in to vote

That case study demonstrates how to execute some logic before causing a drill-down navigation. Like if you wanted to perform an API request and then with the result of that request decide whether you do the drill-down or show an error message.

So when you tap the nav link, a setNavigation(true) action is sent, but we don't actually update state to have isNavigationActive=true. Instead, we fire off an effect, and when the effect finishes we then set isNavigationActive=true which then causes the drill-down to happen.

Does that help?

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@phi161
Comment options

@mbrandonw
Comment options

@phi161
Comment options

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